Repository navigation
Conversation
|
|
||
| public class PersonstTest { | ||
| @BeforeEach | ||
| public void initEnvironment() { |
There was a problem hiding this comment.
Ага, забыл про нее. Я пытался общую инициализацию объектов для теста выделить, но в итоге по другому сделал.
| @Override | ||
| public Double readDouble(String promt) { | ||
| try { | ||
| var scanner = new Scanner(System.in); |
There was a problem hiding this comment.
Лучшее переиспользовать инстанс Scanner, а не создавать каждый раз новый.
There was a problem hiding this comment.
Вот проблема. Он видимо перехватывает стандартный ввод/вывод и после чтения ввода из сканера не отрабатывает стандартный System.out.
| public int readInteger(String promt) { | ||
| var scanner = new Scanner(System.in); | ||
| System.out.println(promt); | ||
| return scanner.nextInt(); |
There was a problem hiding this comment.
hasNextInt
| return String.format("%s: %.2f %s", name, price, getCurencyString()); | ||
| } | ||
| @Override | ||
| public boolean equals(Object o) { |
There was a problem hiding this comment.
Не вижу чтобы они сравнивались, зачем тогда equals?
There was a problem hiding this comment.
Вот это выражение в тесте assertThat(calculator.getGoods()).hasSameElementsAs(goods) не будет работать. Там через equals сравнение идет.
No description provided.