Open
Conversation
mighty-mhsl
reviewed
Oct 29, 2023
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' |
| import java.util.Map; | ||
|
|
||
| public class OlivandersShop { | ||
| List<WandOrder> orders = new ArrayList<>(); |
|
|
||
| public Wand findMostPowerfulWand() throws OrdersListIsEmptyException { | ||
| if (orders.isEmpty()) { | ||
| throw new OrdersListIsEmptyException("Список заказов пуст"); |
Contributor
There was a problem hiding this comment.
Можно использовать пустой Optional
Author
There was a problem hiding this comment.
По подсказке 1 должно выбрасываться исключение с этим именем.
| Integer coreMaterialCnt = coreMaterialCount.get(coreMaterial); | ||
| if (coreMaterialCnt == null || coreMaterialCnt < order.getQuantity()) { | ||
| throw new NotEnoughMaterialException(woodType); | ||
| } |
Contributor
There was a problem hiding this comment.
Дубликация кода. Можно вынести в приватный метод
| try { | ||
| System.out.println(olivandersShop.findMostPowerfulWand()); | ||
| } catch (OrdersListIsEmptyException e) { | ||
| throw new RuntimeException(e); |
Contributor
There was a problem hiding this comment.
Исключения нужно хотя бы логировать. А еще лучше корректно обрабатывать, если есть возможность
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task 2 is done