Skip to content

Diplom_1#1275

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

Diplom_1#1275
NMako69 wants to merge 2 commits intoyandex-praktikum:mainfrom
NMako69:develop1

Conversation

@NMako69
Copy link

@NMako69 NMako69 commented Mar 8, 2026

No description provided.

this.expectedPrice = expectedPrice;
}

@Parameterized.Parameters

Choose a reason for hiding this comment

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

⚠️Можно улучшить. В параметризованных тестах для аннотации Parameterized.Parameters лучше использовать аргумент name: @Parameterized.Parameters(name = "Тестовые данные: {0} {1}"), где {0}, {1} - индексы параметров. Это повысит информативность проверки

public void getReceiptTest() {
String receipt = burger.getReceipt();

assertTrue(receipt.contains("white bun"));

Choose a reason for hiding this comment

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

⛔️Нужно исправить. Строку рецепта проверяем целиком, чтобы не пропустить ошибки форматирования

private Burger burger;

@Mock
private Ingredient ingredient1;

Choose a reason for hiding this comment

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

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

public void addIngredientTest() {
burger.addIngredient(ingredient1);

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. Поправь, пожалуйста, во всем коде

@NMako69 NMako69 closed this Mar 14, 2026
@NMako69 NMako69 reopened this Mar 14, 2026
@NMako69 NMako69 closed this Mar 14, 2026
@NMako69 NMako69 reopened this Mar 14, 2026
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