Skip to content

Commit 36e9ed1

Browse files
add on more test case #103
1 parent 8a8fdb4 commit 36e9ed1

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package p;
2+
3+
import java.util.HashSet;
4+
import java.util.stream.*;
5+
6+
import edu.cuny.hunter.streamrefactoring.annotations.*;
7+
8+
class A {
9+
10+
Stream<Object> m() {
11+
Stream<Object> stream = new HashSet<>().parallelStream().sorted();
12+
return stream;
13+
}
14+
15+
@EntryPoint
16+
void n() {
17+
Stream<Object> s = m();
18+
s.distinct().count();
19+
}
20+
}

edu.cuny.hunter.streamrefactoring.tests/test cases/edu/cuny/hunter/streamrefactoring/ui/tests/ConvertStreamToParallelRefactoringTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,14 @@ public void testNonInternalAPI4() throws Exception {
477477
false, null, null, null, RefactoringStatus.ERROR,
478478
EnumSet.of(PreconditionFailure.NO_TERMINAL_OPERATIONS)));
479479
}
480-
480+
481+
public void testNonInternalAPI5() throws Exception {
482+
helper(new StreamAnalysisExpectedResult("new HashSet<>().parallelStream()",
483+
Collections.singleton(ExecutionMode.PARALLEL), Collections.singleton(Ordering.UNORDERED), false,
484+
false, false, null, null, null, RefactoringStatus.ERROR,
485+
EnumSet.of(PreconditionFailure.NO_TERMINAL_OPERATIONS)));
486+
}
487+
481488
public void testCollectionFromParameter() throws Exception {
482489
helper(new StreamAnalysisExpectedResult("h.parallelStream()", Collections.singleton(ExecutionMode.PARALLEL),
483490
Collections.singleton(Ordering.UNORDERED), false, true, false, null, null, null,

0 commit comments

Comments
 (0)