-
Notifications
You must be signed in to change notification settings - Fork 0
Sprint 6 #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/main/java/com/example/Cat.java
Outdated
|
|
||
| public Cat(Feline feline) { | ||
| this.predator = feline; | ||
| public Cat(Predator predator) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛔️Нужно исправить. Вносим изменения только в класс Lion. Остальные классы не меняем. Не вижу правок для класса Lion
|
|
||
| @Test | ||
| public void testGetFoodHerbivore() throws Exception { | ||
| Animal animal = new Animal(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Exception exception = assertThrows(Exception.class, () -> animal.getFood("Непонятно")); | ||
| assertEquals("Неизвестный вид животного, используйте значение Травоядное или Хищник", exception.getMessage()); | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛔️Нужно исправить. Нет тестов на остальные классы. Пулл реквест создан неверное
|
|
||
| Cat cat = new Cat(felineMock); | ||
| public void testGetFood() throws Exception { | ||
| when(feline.eatMeat()).thenReturn(List.of("Мясо")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛔️Нужно исправить. Мок должен вести себя как реальный объект и возвращать List.of("Животные", "Птицы", "Рыба");
|
|
||
| assertEquals(List.of("Рыба", "Птицы"), food); | ||
| verify(felineMock, times(1)).eatMeat(); | ||
| assertEquals(List.of("Мясо"), food); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛔️Нужно исправить. Для юнит-тестов применим подход: один тест, значит одна проверка. В этом тесте две проверки (Mockito.verify, assertEquals), а должна быть одна. Исправь, пожалуйста, этот момент во всем коде.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛔️Нужно исправить. Папку .idea не нужно было загружать в репозиторий. Эта папка должна быть добавлена в .gitignore.
|
|
||
| private boolean hasMane; | ||
| private Feline feline; | ||
| private final Predator predator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛔️Нужно исправить. Нужно использовать Feline feline;
| new Lion("Неизвестно", predator); | ||
| }); | ||
| assertEquals("Используйте допустимые значения пола животного - Самец или Самка", exception.getMessage()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛔️Нужно исправить. Нет параметризированных тестов
⛔️Нужно исправить. Нет тестов на класс feline
No description provided.