-
Notifications
You must be signed in to change notification settings - Fork 12
Task 2 #17
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: master
Are you sure you want to change the base?
Task 2 #17
Conversation
build.gradle
Outdated
| testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2' | ||
| testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2' | ||
| // compileOnly 'org.projectlombok:lombok' | ||
| // annotationProcessor 'org.projectlombok:lombok' |
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.
Не оставляем комменты
| import java.util.Map; | ||
|
|
||
| public class OlivandersShop { | ||
| List<WandOrder> orders = new ArrayList<>(); |
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 поле
|
|
||
| public Wand findMostPowerfulWand() throws OrdersListIsEmptyException { | ||
| if (orders.isEmpty()) { | ||
| throw new OrdersListIsEmptyException("Список заказов пуст"); |
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.
Можно использовать пустой Optional
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.
По подсказке 1 должно выбрасываться исключение с этим именем.
| Integer coreMaterialCnt = coreMaterialCount.get(coreMaterial); | ||
| if (coreMaterialCnt == null || coreMaterialCnt < order.getQuantity()) { | ||
| throw new NotEnoughMaterialException(woodType); | ||
| } |
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.
Дубликация кода. Можно вынести в приватный метод
| try { | ||
| System.out.println(olivandersShop.findMostPowerfulWand()); | ||
| } catch (OrdersListIsEmptyException e) { | ||
| throw new RuntimeException(e); |
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.
Исключения нужно хотя бы логировать. А еще лучше корректно обрабатывать, если есть возможность
Task 2 is done