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

Migrate from com.google.common.collect.Range and com.google.common.collect.Ranges to java.util.stream.IntStream #63

Merged
merged 2 commits into from Aug 2, 2021

Conversation

basil
Copy link
Member

@basil basil commented May 9, 2021

com.google.common.collect.Ranges was removed in Guava 15, so consuming this API is a liability. This PR replaces usages of com.google.common.collect.Range and com.google.common.collect.Ranges with usages of java.util.stream.IntStream to avoid any breakage when running on newer versions of Guava.

Before I started this change, I improved the tests to ensure that they were checking for the appropriate error messages for range violations. This gave me confidence that my refactoring was successful. Along the way, I found and fixed a bug in one of the tests as well.

@@ -670,7 +677,7 @@ public void nonExistentProxyAuthFailsTheBuild() throws Exception {
WorkflowJob proj = j.jenkins.createProject(WorkflowJob.class, "proj");
proj.setDefinition(new CpsFlowDefinition(
"def response = httpRequest url:'"+baseURL()+"/proxyAuth',\n" +
" proxy: 'http://proxy.example.com:8080',\n" +
" httpProxy: 'http://proxy.example.com:8080',\n" +
Copy link
Member Author

Choose a reason for hiding this comment

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

This test had been passing erroneously. Adding a proper assertion exposed this bug in the test, which is now fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant