Skip to content
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

Junit 5 ConcurrentModificationException update for BinarySearchTreeTest #294

Closed
mmaurier opened this issue Dec 3, 2021 · 2 comments
Closed

Comments

@mmaurier
Copy link

mmaurier commented Dec 3, 2021

Here's the code change for Junit 5 on BinarySearchTreeTest for ConcurrentModificationException:

@test
public void concurrentModificationErrorRemovingPreOrder() throws ConcurrentModificationException {

Assertions.assertThrows(ConcurrentModificationException.class, () -> {
		
	BinarySearchTree<Integer> bst = new BinarySearchTree<>();
		
	bst.add(1);
	bst.add(2);
	bst.add(3);
		
	Iterator<Integer> iter = bst.traverse(TreeTraversalOrder.PRE_ORDER);
		
	while (iter.hasNext()) {
		bst.remove(2);
		iter.next();
	}
});

}

Same goes for InOrder, PostOrder, and LeveOrder test.

@williamfiset
Copy link
Owner

The current impl is using Junit 4 and is WAI. Please send a PR if you want to upgrade to Junit 5, altough that might breaks other tests along the way

https://github.com/williamfiset/Algorithms/blob/master/build.gradle#L35

@mmaurier
Copy link
Author

mmaurier commented Dec 8, 2021

Sounds good. I'll start a branch called 'Update to Junit5'. I'm studying for an interview with Google next month using your Algorithms repository and your youtube video also. Can you leave the branch open until I finish with the entire repository? This way we avoid breaking other test cases and you can test the branch at your own leisure.

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

No branches or pull requests

2 participants