Skip to content
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

Remove unnecessary boxing #266

Merged
merged 1 commit into from Jan 27, 2019
Merged

Conversation

marschall
Copy link
Member

@marschall marschall commented Dec 30, 2018

Several tests contain code that can be simplified using autoboxing.


This change is Reviewable

Several tests contain code that can be simplified using autoboxing.
@@ -43,7 +43,7 @@ public void shouldExchangeCurrencyPositiveValue() {
MonetaryAmount result = ConversionOperators.exchange(real).apply(money);
assertNotNull(result);
assertEquals(result.getCurrency(), real);
assertEquals(Double.valueOf(2.35), result.getNumber().doubleValue());
assertEquals(2.35d, result.getNumber().doubleValue());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it's better to make the d literal in uppercase for consistency with L for longs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you do this across the entire code base? Also for floats?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't say that this is correct style and I guess this should be decided by the project leaders.
But actually I would like to rise another point: most asserEquals() by the Double are checking an amount so maybe we can simplify to make an equals my MonetaryAmount ie.
assertEquals(result, Money.of(2.35, "USD");

@keilw keilw merged commit 5b059ed into JavaMoney:master Jan 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants