-
Notifications
You must be signed in to change notification settings - Fork 0
Часть 1, unit-тесты и отчет о 100% покрытии JaCoCo #1
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
base: main
Are you sure you want to change the base?
Conversation
.idea/compiler.xml
Outdated
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.
⛔️Нужно исправить. Папку .idea не нужно было загружать в репозиторий. Эта папка должна быть добавлена в .gitignore.
pom.xml
Outdated
| </dependency> | ||
|
|
||
| <!-- Зависимость Gson для работы с JSON --> | ||
| <dependency> |
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.
⛔️Нужно исправить. данном задание с Gson не работаем
src/test/java/praktikum/BunTest.java
Outdated
| import junitparams.Parameters; | ||
|
|
||
| @RunWith(JUnitParamsRunner.class) | ||
| public class BunTest { |
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.
|
|
||
| private Burger burger; | ||
| private Bun bunMock; | ||
| private Ingredient ingredientMock1; |
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.
⛔️Нужно исправить. При нейминге не рекомендуется использовать числа (Field2), их еще называют magicNumbers. Очень тяжело поддерживать код с magicNumbers.
| public void testAddIngredient() { | ||
| burger.setBuns(bunMock); | ||
| burger.addIngredient(ingredientMock1); | ||
| assertEquals(1, burger.ingredients.size()); |
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.
⛔️Нужно исправить. Для юнит-тестов придерживаемся подхода: один тест, значит одна проверка. Если очень хочется несколько проверок -- тогда используем softAssertions. Поправь, пожалуйста, во всем коде
| private Burger burger; | ||
| private Bun bunMock; | ||
| private Ingredient ingredientMock1; | ||
| private Ingredient ingredientMock2; |
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.
⛔️Нужно исправить. По заданию для бургер тестов нужно реализовать параметризированные тесты. Какие именно, решай сама
| burger.addIngredient(fillingIngredient); | ||
|
|
||
| burger.moveIngredient(0, 1); | ||
| assertEquals(fillingIngredient, burger.ingredients.get(0)); |
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.
⛔️Нужно исправить. Для юнит-тестов придерживаемся подхода: один тест, значит одна проверка. Если очень хочется несколько проверок -- тогда используем softAssertions. Поправь, пожалуйста, во всем коде
| public void testReceiptContainsBunName() { | ||
| burger.setBuns(bunMock); | ||
| String receipt = burger.getReceipt(); | ||
| assertTrue(receipt.contains(bunMock.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.
⛔️Нужно исправить. Нужно оставить только папку jacoco. Остальные файлы удалить из пулл реквеста
No description provided.