Skip to content

Instantly share code, notes, and snippets.

@POMXARK
Created June 4, 2024 13:02
Show Gist options
  • Save POMXARK/bbf61500a434d39121022105b2ae8695 to your computer and use it in GitHub Desktop.
Save POMXARK/bbf61500a434d39121022105b2ae8695 to your computer and use it in GitHub Desktop.
TDD java junit
public class Dollar {
int amount;
Dollar(int amount) {
}
void times(int multiplier) {
}
}
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