Skip to content

Unit tests for class Burger#1260

Open
iseverina wants to merge 2 commits intoyandex-praktikum:mainfrom
iseverina:develop1
Open

Unit tests for class Burger#1260
iseverina wants to merge 2 commits intoyandex-praktikum:mainfrom
iseverina:develop1

Conversation

@iseverina
Copy link

@iseverina iseverina commented Feb 18, 2026

Были выполнены Юнит-тесты для класса Burger, и так же сделан отчет Jacoco с полным покрытием тестов для этого класса


Ingredient ingredient = mock(Ingredient.class);
burger.addIngredient(ingredient);
assertEquals(1, burger.ingredients.size());

Choose a reason for hiding this comment

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

⛔️Нужно исправить. Для юнит-тестов придерживаемся подхода: один тест, значит одна проверка. Если очень хочется несколько проверок -- тогда используем softAssertions. Поправь, пожалуйста, во всем коде

public void removeIngredientTest () {
Burger burger = new Burger();

Ingredient ingredient1 = mock(Ingredient.class);

Choose a reason for hiding this comment

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

⛔️Нужно исправить. При нейминге не рекомендуется использовать числа (Field2), их еще называют magicNumbers. Очень тяжело поддерживать код с magicNumbers.

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.

2 participants