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

JDK-8273154: Provide a JavadocTester method for non-overlapping, unordered output matching #5743

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import java.util.List;
import java.util.Optional;
import java.util.regex.Pattern;
import java.util.stream.Stream;

import toolbox.ToolBox;

Expand Down Expand Up @@ -256,7 +257,7 @@ public void testSimpleRegexCheck() {
@Test
public void testOrdered() {
messages.clear();
// methods are listed alphabetiocally in the Summary table,
// methods are listed alphabetically in the Summary table,
// but in source-code order in the Details section.
new OutputChecker("p/C.html")
.check("<h2>Method Summary</h2>",
Expand Down Expand Up @@ -329,7 +330,7 @@ public void testUnordered_unexpected() {
@Test
public void testComplete_Ordered() {
messages.clear();
// In this following calls, the strings are specified in the expected order.
// In the following calls, the strings are specified in the expected order.
// File separators are made platform-specific by calling 'fix'.
// Newlines are handled automatically by the 'check' method.
new OutputChecker(Output.OUT)
Expand All @@ -350,7 +351,7 @@ public void testComplete_Ordered() {
@Test
public void testComplete_Unordered() {
messages.clear();
// In this following calls, the strings are deliberately specified out of the expected order.
// In the following calls, the strings are deliberately specified out of the expected order.
// File separators are made platform-specific by calling 'fix'.
// Newlines are handled automatically by the 'check' method.
new OutputChecker(Output.OUT)
Expand Down Expand Up @@ -430,8 +431,8 @@ private String fix(String item) {
* @param items the strings
*/
private String[] fix(String... items) {
return List.of(items).stream()
return Stream.of(items)
Copy link
Member

Choose a reason for hiding this comment

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

While List.of(items).stream() is not equivalent to Stream.of(items), that fix method (as a whole) still behaves the same way. One difference between those two approaches of creating an ordered stream is their behavior in regard to the null item.

.map(this::fix)
.toArray(String[]::new);
}
}
}
You are viewing a condensed version of this merge commit. You can view the full changes here.