Skip to content

Parse bracketed numbers as negative numbers#2226

Merged
anand-uk merged 3 commits intomasterfrom
parse_bracketed_numbers
Sep 17, 2020
Merged

Parse bracketed numbers as negative numbers#2226
anand-uk merged 3 commits intomasterfrom
parse_bracketed_numbers

Conversation

@anand-uk
Copy link
Copy Markdown
Contributor

No description provided.

assertThat(LoaderUtils.parseInteger("(23)")).isEqualTo(-23);
assertThatIllegalArgumentException()
.isThrownBy(() -> LoaderUtils.parseInteger("()"))
.withMessage("Unable to parse integer from '()'");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With AssertJ you have to put the withMessage before the method that actually throws, otherwise the message is not picked up. Needs fixing in all the methods below.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My mistake. This is correctly testing the message that is thrown.

assertThat(LoaderUtils.parseInteger("(23)")).isEqualTo(-23);
assertThatIllegalArgumentException()
.isThrownBy(() -> LoaderUtils.parseInteger("()"))
.withMessage("Unable to parse integer from '()'");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My mistake. This is correctly testing the message that is thrown.

@anand-uk anand-uk merged commit 8a66765 into master Sep 17, 2020
@delete-merged-branch delete-merged-branch bot deleted the parse_bracketed_numbers branch September 17, 2020 10:15
@jodastephen jodastephen added this to the v2.9 milestone Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants