Skip to content

Conversation

@JunHyungJang
Copy link
Contributor

@JunHyungJang JunHyungJang commented Jul 15, 2024

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

Please 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.

Copy link
Member

@joel-costigliola joel-costigliola left a 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();
Copy link
Member

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() {
Copy link
Member

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() {
Copy link
Member

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() {
Copy link
Member

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

Copy link
Member

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() {
Copy link
Member

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{
Copy link
Member

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) {
Copy link
Member

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

Copy link
Member

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

@JunHyungJang
Copy link
Contributor Author

@joel-costigliola

Thank you for the great comment. I change the files following the comment.

  1. Add the error unit test
  2. change assertThat -> BDDAssertions.then
  3. use parametized test instead of using pure test
  4. mvn spotless:apply

@JunHyungJang JunHyungJang closed this by deleting the head repository Aug 1, 2024
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.

Add assertion methods for floating point and integer format of BigDecimal

2 participants