Created
June 4, 2024 13:02
-
-
Save POMXARK/bbf61500a434d39121022105b2ae8695 to your computer and use it in GitHub Desktop.
TDD java junit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Dollar { | |
int amount; | |
Dollar(int amount) { | |
} | |
void times(int multiplier) { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static junit.framework.TestCase.assertEquals; | |
public class ExampleTest { | |
public void testMultiplication() { | |
Dollar five = new Dollar(5); | |
five.times(2); | |
assertEquals(10, five.amount); | |
} | |
} | |
/* | |
1 шаг | |
1) определим класс Dollar | |
2) Добавим конструктор в класс Dollar | |
3) Добавим метод times в класс Dollar | |
4) создать поле (переменную) amount в класс Dollar | |
2 шаг | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment