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

GP-50 Refactor binary search tree tests using reflection #59

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
shryhus merged 5 commits into main from GP-50-RefactorBinarySearchTreeUsingReflection
Feb 8, 2021

Conversation

Copy link

@ivanvirchenko ivanvirchenko commented Feb 4, 2021

No description provided.

@ivanvirchenko ivanvirchenko changed the title (削除) GP-50 Fix method names in binary search tree tests (削除ここまで) (追記) GP-50 Refactor binary search tree tests using reflection (追記ここまで) Feb 4, 2021
Copy link
Contributor

@shryhus shryhus left a comment

Choose a reason for hiding this comment

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

Please don't remove old PRs, use "Force push" instead to save review story.

Object nodeInstance;
Constructor<?> constructor = getInnerClass().getDeclaredConstructors()[0];
constructor.setAccessible(true);
nodeInstance = constructor.newInstance(element);
Copy link
Contributor

@shryhus shryhus Feb 5, 2021

Choose a reason for hiding this comment

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

What if Node class doesn't have constructor with parameter, we should predict this case.

ivanvirchenko reacted with thumbs up emoji
Copy link
Contributor

@shryhus shryhus Feb 7, 2021
edited
Loading

Choose a reason for hiding this comment

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

If I don't declare any constructor in Node class but set an element this way: Node<T> newNode = new Node<>(); newNode.element = element; the tests won't pass. You can see an example to resolve this issue in LinkedList tests.

Object nodeInstance;
Constructor<?> constructor = getInnerClass().getDeclaredConstructors()[0];
constructor.setAccessible(true);
nodeInstance = constructor.newInstance(element);
Copy link
Contributor

@shryhus shryhus Feb 7, 2021
edited
Loading

Choose a reason for hiding this comment

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

If I don't declare any constructor in Node class but set an element this way: Node<T> newNode = new Node<>(); newNode.element = element; the tests won't pass. You can see an example to resolve this issue in LinkedList tests.

@shryhus shryhus merged commit 9326b0c into main Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@shryhus shryhus shryhus 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 によって変換されたページ (->オリジナル) /