Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor ArrayList tests changes #53

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

Merged
tboychuk merged 3 commits into main from GP-49-RefactorArrayListTestUsingReflectionAPI
Jan 30, 2021

Conversation

Copy link

@ivanvirchenko ivanvirchenko commented Jan 29, 2021

No description provided.

Copy link
Contributor

@tboychuk tboychuk left a comment

Choose a reason for hiding this comment

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

@erneman1 very nice overall! 💪
Just a couple of minor comments.


arrayList.clear();

assertThatExceptionOfType(IndexOutOfBoundsException.class)
.isThrownBy(() -> arrayList.get(0));
}

/***** Helper methods *****/
Copy link
Contributor

Choose a reason for hiding this comment

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

@erneman1 please remove this line. All private methods are considered as helper methods.


private Object[] getTestArray() {
Object[] array = null;

Copy link
Contributor

Choose a reason for hiding this comment

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

@erneman1 I would rather remove these blank lines.

return name;
}

private void fillTestArray(Object... elements) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@erneman1 why don't you want to use @SneakyThrows? Please add it to these helper methods.

assertThat(arrayList.get(0)).isEqualTo(10);
assertThat(arrayList.get(1)).isEqualTo(15);
assertThat(arrayList.get(2)).isEqualTo(20);
assertThat(getTestArray()[0]).isEqualTo(10);
Copy link
Contributor

Choose a reason for hiding this comment

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

@erneman1 I guess it will be clearer when we first get the array and then do all assertions. Since calling a method and adding square brackets right away does not look good. So let's separate that in all tests.
E.g.

Object[] internalArray = getTestArray();
assertThat(internalArray[0]).isEqualTo(10);

@tboychuk tboychuk merged commit 85d38fc into main Jan 30, 2021
@tboychuk tboychuk deleted the GP-49-RefactorArrayListTestUsingReflectionAPI branch January 30, 2021 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@tboychuk tboychuk tboychuk approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /