Skip to content

Conversation

@fe-y
Copy link
Owner

@fe-y fe-y commented Sep 7, 2025

No description provided.

when(felineMock.eatMeat()).thenReturn(List.of("Рыба", "Птицы"));
void testGetKittens() {
when(mockFeline.getKittens()).thenReturn(1); // обязательно для мока
assertEquals(1, cat.getKittens());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛔️Нужно исправить. Для юнит-тестов применим подход: один тест, значит одна проверка. В этом тесте две проверки (Mockito.verify, assertEquals), а должна быть одна. Исправь, пожалуйста, этот момент во всем коде.

when(felineMock.getKittens()).thenReturn(3);
void testGetKittens() throws Exception {
Feline mockFeline = mock(Feline.class);
when(mockFeline.getKittens()).thenReturn(2);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛔️Нужно исправить. Мок должен вести себя как реальный объект и возвращать 1

@@ -0,0 +1 @@

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛔️Нужно исправить. Нет отчета о тестировании

@fe-y fe-y force-pushed the Sprint_6_final_push branch from 627c64d to 31839c0 Compare September 7, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants