-
-
Notifications
You must be signed in to change notification settings - Fork 766
Add BigDecimalAssertion for floatingPointFormat and IntegerPointFormat #3538
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
Conversation
feat : BigDecimalAssertion feature + test
joel-costigliola
left a comment
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.
First round of comments, thanks @JunHyungJang !
| // given | ||
| BigDecimal bigDecimal = new BigDecimal("653.401"); | ||
| // when/then | ||
| assertThat(bigDecimal).isInFloatingPointFormat(); |
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.
use BDDAssertions.then
|
|
||
| public class BigDecimalAssert_isInFloatingPointFormat_Test { | ||
| @Test | ||
| void should_pass_if_actual_is_in_floating_point_format() { |
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.
use a parameterized test passing floating point values
| } | ||
|
|
||
| @Test | ||
| void should_fail_if_actual_is_not_in_floating_point_format() { |
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.
use a parameterized test passing non floating point values
| import static org.assertj.core.util.AssertionsUtil.expectAssertionError; | ||
| public class BigDecimalAssert_isInIntegerFormat_Test { | ||
| @Test | ||
| void should_pass_if_actual_is_in_integer_format() { |
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.
use a parameterized test passing integer values
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.
example of a parameterized test: Index_Test
| } | ||
|
|
||
| @Test | ||
| void should_fail_if_actual_is_not_in_integer_format() { |
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.
use a parameterized test passing non integer values
| @@ -0,0 +1,15 @@ | |||
| package org.assertj.core.error; | |||
|
|
|||
| public class ShouldBeInFloatingPointFormat extends BasicErrorMessageFactory{ | |||
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.
Add a unit test for this, you can take ShouldBeEven_create_Test as an example to follow
| @@ -0,0 +1,11 @@ | |||
| package org.assertj.core.error; | |||
|
|
|||
| public class ShouldBeInIntegerFormat extends BasicErrorMessageFactory{ public static ErrorMessageFactory shouldBeInIntegerFormat(Object actual) { | |||
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.
Add a unit test for this, you can take ShouldBeEven_create_Test as an example to follow
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.
reformat the code with mvn spotless:apply
|
Thank you for the great comment. I change the files following the comment.
|
This is my first attempt to contribute the open sources, so I am not sure what I should do exactly.
I add Assertion and AssertionTest for floatingPointForamt and IntegerPointFormat following
BigDecimal#3532Please let me know, if I should do something more or something to fix
Thank you
Check List:
Following the contributing guidelines will make it easier for us to review and accept your PR.