Skip to content

Commit 8a8fdb4

Browse files
test cases for #103
1 parent 5bf1932 commit 8a8fdb4

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
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<>().stream().distinct();
12+
return stream;
13+
}
14+
15+
@EntryPoint
16+
void n() {
17+
Stream<Object> s = m();
18+
s.count();
19+
}
20+
}
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<>().stream();
12+
return stream;
13+
}
14+
15+
@EntryPoint
16+
void n() {
17+
Stream<Object> s = m();
18+
s.distinct().count();
19+
}
20+
}
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<>().stream().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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,27 @@ public void testNonInternalAPI() throws Exception {
457457
EnumSet.of(PreconditionFailure.NO_TERMINAL_OPERATIONS)));
458458
}
459459

460+
public void testNonInternalAPI2() throws Exception {
461+
helper(new StreamAnalysisExpectedResult("new HashSet<>().stream()",
462+
Collections.singleton(ExecutionMode.SEQUENTIAL), Collections.singleton(Ordering.UNORDERED), false, false,
463+
false, null, null, null, RefactoringStatus.ERROR,
464+
EnumSet.of(PreconditionFailure.NO_TERMINAL_OPERATIONS)));
465+
}
466+
467+
public void testNonInternalAPI3() throws Exception {
468+
helper(new StreamAnalysisExpectedResult("new HashSet<>().stream()",
469+
Collections.singleton(ExecutionMode.SEQUENTIAL), Collections.singleton(Ordering.UNORDERED), false, false,
470+
false, null, null, null, RefactoringStatus.ERROR,
471+
EnumSet.of(PreconditionFailure.NO_TERMINAL_OPERATIONS)));
472+
}
473+
474+
public void testNonInternalAPI4() throws Exception {
475+
helper(new StreamAnalysisExpectedResult("new HashSet<>().stream()",
476+
Collections.singleton(ExecutionMode.SEQUENTIAL), Collections.singleton(Ordering.UNORDERED), false, false,
477+
false, null, null, null, RefactoringStatus.ERROR,
478+
EnumSet.of(PreconditionFailure.NO_TERMINAL_OPERATIONS)));
479+
}
480+
460481
public void testCollectionFromParameter() throws Exception {
461482
helper(new StreamAnalysisExpectedResult("h.parallelStream()", Collections.singleton(ExecutionMode.PARALLEL),
462483
Collections.singleton(Ordering.UNORDERED), false, true, false, null, null, null,

0 commit comments

Comments
 (0)