-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Money Pattern Implementation - Issue #1305 #1673
Conversation
SonarCloud found 2 bugs, which I'll push a fix for. |
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.
Along with the bugs reported you also need to mitigate any code smell that it has and more importantly increase code coverage by providing test cases.
SonarCloud Quality Gate failed. |
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> |
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.
Please add the maven-assembly-plugin as in the other patterns, so that the example can be easily and independently executed on the command line.
* @param money Contains the information required to create the balance. | ||
*/ | ||
public Balance createBalance(Money money) { | ||
Balance createdBalance = new Balance(this, money); |
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.
You're able to use the var
keyword here instead of explicitly defining the type. Check this elsewhere in the code too.
try { | ||
balance.getMoney().subtractMoneyBy(moneyToWithdraw); | ||
} catch (SubtractionCannotOccurException e) { | ||
System.err.println("Insufficient funds in balance."); |
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.
Please use a logger for output. See Lombok @Slf4j
annotation.
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.
Check this throughout the example.
public Money getMoney() { | ||
return money; | ||
} | ||
|
||
public Account getAccount() { | ||
return account; | ||
} | ||
|
||
public boolean isPrimaryBalance() { | ||
return isPrimaryBalance; | ||
} |
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.
To replace boilerplate such as these getters you're able to use Lombok annotations.
boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
} |
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.
I'm not sure you need all these constructors. Maybe define only the ones you use?
I'll get these issues fixed as soon as possible, I just haven't had any extra time on my hands. |
No worries. Take your time and just let us know when you'll be able to complete it. |
The pull request has remained inactive and is about to be closed. Please comment if you're still working on it. |
Closed due to inactivity |
Money Pattern Implementation
Pull request description