-
Notifications
You must be signed in to change notification settings - Fork 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
InCamp Task #7
base: master
Are you sure you want to change the base?
InCamp Task #7
Conversation
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.
Improve code style
src/checkout/Check.java
Outdated
int getCostByCategory(Category category) { | ||
return products.stream() | ||
.filter(p -> p.category == category) | ||
.mapToInt(p -> p.price) | ||
.reduce(0, (a, b) -> a + b); | ||
} | ||
|
||
int getCostByOutlet(Outlet outlet) { |
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.
Implement generic getSubCost
method and pass Predicate<Product>
as parameter.
|
||
@Override | ||
public boolean checkCondition(Check check) { | ||
if(check.getCostByCategory(category) != 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.
configure required amount
src/checkout/ConditionByOutlet.java
Outdated
|
||
@Override | ||
public boolean checkCondition(Check check) { | ||
if(check.getCostByOutlet(outlet) != 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.
configure required amount
src/checkout/Offer.java
Outdated
|
||
public Offer(LocalDate expiredDate, Reward rewardType, Condition conditionType) { | ||
this.expiredDate = expiredDate; | ||
this.rewardType = rewardType; |
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.
Remove type form field names
test/CheckoutServiceTest.java
Outdated
@@ -1,6 +1,9 @@ | |||
import checkout.*; | |||
import org.junit.jupiter.api.BeforeEach; | |||
import org.junit.jupiter.api.Test; | |||
import sun.security.x509.CertAttrSet; |
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.
Remove wrong inport
No description provided.