Skip to content

Introduce assertj in resistor-color exercise #1984

Merged
jmrunkle merged 3 commits into
exercism:mainfrom
thtroyer:resistor-color_assertj
Sep 4, 2021
Merged

Introduce assertj in resistor-color exercise #1984
jmrunkle merged 3 commits into
exercism:mainfrom
thtroyer:resistor-color_assertj

Conversation

@thtroyer
Copy link
Copy Markdown
Contributor

@thtroyer thtroyer commented Sep 4, 2021

pull request

For issue #1982

Converting junit assertions into AssertJ assertions and ran tests against the reference implementation.

Let me know if there are any issues. I opted to use concise assertion statements as I feel AssertJ is more readable with them.


Reviewer Resources:

Track Policies

@thtroyer thtroyer changed the title Changing ResistorColor unit tests to use AssertJ. Introduce assertj in resistor-color exercise Sep 4, 2021
String[] expected = {"black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"};

assertArrayEquals(expected, resistorColor.colors());
assertThat(resistorColor.colors()).isEqualTo(
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.

isEqualTo is probably the wrong assertion for an array. We want containsExactly behavior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I'll fix it.

Copy link
Copy Markdown
Contributor

@jmrunkle jmrunkle left a comment

Choose a reason for hiding this comment

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

This looks good aside from the possible style violation.

String[] expected = {"black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"};

assertArrayEquals(expected, resistorColor.colors());
assertThat(resistorColor.colors()).containsExactly("black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white");
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.

This might not pass style checks, but I am working on getting that workflow re-enabled: #1988

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can I view the style guidelines somewhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nevermind. I found the gradle check command.

@jmrunkle jmrunkle merged commit 30ff775 into exercism:main Sep 4, 2021
@thtroyer thtroyer deleted the resistor-color_assertj branch September 7, 2021 16:11
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.

2 participants