-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Develop1 #924
base: main
Are you sure you want to change the base?
Develop1 #924
Conversation
src/test/java/BunTest.java
Outdated
|
||
@Test | ||
public void getNameBunTest() { | ||
Assert.assertEquals("Флюоресцентная булка R2-D3", bun.getName()); |
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.
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.
Добавил поясняющие сообщения для assert.
src/test/java/BunTest.java
Outdated
|
||
@Before | ||
public void init() { | ||
bun = new Bun("Флюоресцентная булка R2-D3", Float.valueOf(998)); |
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.
⛔️Нужно исправить. Ты проверила позитивные тесты для цены и названия булочки. Это хорошо. Но давай применим метод КЭ и ГЗ и проверим хотя бы основные КЭ. Например, для цены -- отрицательная цена, ноль, положительная цена (дробная)
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.
Добавил проверки.
src/test/java/BurgerTest.java
Outdated
private String receipt; | ||
|
||
@Spy | ||
Burger burger; |
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.
⛔️Нужно исправить. Создавай моки только для зависимостей, а не для тестируемого объекта. Bun и Ingredient должны быть моками
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.
Использовал моки для Bun и Ingredient.
src/test/java/BurgerTest.java
Outdated
bun = new Bun(BUN_NAME, BUN_PRICE); | ||
ingredientTypeSauce = IngredientType.SAUCE; | ||
ingredientTypeFilling = IngredientType.FILLING; | ||
Ingredient ingredientSauce = new Ingredient(ingredientTypeSauce, SAUSE_NAME, SAUSE_PRICE); |
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.
⛔️Нужно исправить. Используй моки, а не реальные объекты.
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.
После добавления моков для Bun и Ingredient использовал их, вместо реальных объектов.
src/test/java/BurgerTest.java
Outdated
// Собираем бургер | ||
// Добавляем булку | ||
burger.setBuns(bun); | ||
Mockito.verify(burger).setBuns(bun); |
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.
⛔️ Нужно исправить. Для юнит-тестов применим подход: один тест, значит одна проверка - один assert. Каждую проверку нужно вынести в отдельный тест. Поправь, пожалуйста этот момент во всем коде
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.
Каждую проверку вынес в отдельный тест.
} | ||
|
||
@Parameterized.Parameters | ||
public static Object[][] setParams() { |
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.
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.
Добавил аргумент name в аннотацию Parameterized.Parameters
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.
⛔️Нужно исправить. Не проверен enum IngredientType
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.
Добавил проверку для enum IngredientType.
burger.addIngredient(ingredientFilling); | ||
burger.addIngredient(ingredientFilling); | ||
// Удаляем ингредиенты | ||
burger.removeIngredient(1); |
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.
⛔️ Нужно исправить. Для юнит-тестов применим подход: один тест, значит одна проверка - один assert. Поправь, пожалуйста этот момент во всем коде.
- На удаление ингредиента - отдельные тест
- На добавление ингредиента - отдельные тест итд
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.
Исправил
} | ||
|
||
@Test | ||
public void test(){ |
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.
⛔️Нужно исправить. Неинформативный заголовок
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.
Исправил
No description provided.