Skip to content
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

Задание 1: юнит-тесты #902

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

SergeiMarkov
Copy link

No description provided.

@Test
public void setBunTest() {
burger.setBuns(bun);

Choose a reason for hiding this comment

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

⚠️Можно улучшить. Для расстановки пробелов и табуляции в соответствии с настройками Code Style в Idea используй сочетание клавиш Ctrl+Alt+L. Также можно установить курсор на корневую директорию и нажать клавиш Ctrl+Alt+L, отметить чек-боксы: cleanup code, а также optimize imports(для оптимизации импортов) и rearrange entries(для изменения порядка переменных и методов в соответствии с best practics)

public void addIngredientTest() {
burger.addIngredient(ingredient1);
burger.addIngredient(ingredient2);
assertEquals("Количество ингредиентов не соответствует ожидаемому", 2, burger.ingredients.size());

Choose a reason for hiding this comment

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

⚠️Можно улучшить. Если в тесте несколько ассертов, то лучше использовать softAssertions (org.assertj.core.api.SoftAssertions). В этом случае всегда будут проверяться все ассерты. В текущей реализации, если первый ассерт упадет, второй ассерт проверяться не будет.

public void NegativeCreateNonValidBunTest(){
Bun bun = new Bun(bunName, bunPrice);

assertNotNull("Невалидные значения для названия булочки или цены булочки", bun);

Choose a reason for hiding this comment

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

⚠️Можно улучшить. Целесообразно проверить, что имя и цена корректны

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