Skip to content

Commit b14b00a

Browse files
akarnokdviktorklang
authored andcommitted
Flow-TCK is set up as Java 6 compile target
1 parent 41efae4 commit b14b00a

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

tck-flow/src/test/java/org/reactivestreams/tck/flow/SubmissionPublisherTest.java

+20-15
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,46 @@
1212
package org.reactivestreams.tck.flow;
1313

1414
import org.reactivestreams.tck.TestEnvironment;
15+
import org.testng.annotations.Test;
1516

1617
import java.util.concurrent.*;
1718

19+
@Test
1820
public class SubmissionPublisherTest extends FlowPublisherVerification<Integer> {
1921

2022
public SubmissionPublisherTest() {
2123
super(new TestEnvironment());
2224
}
2325

2426
@Override
25-
public Flow.Publisher<Integer> createFlowPublisher(long elements) {
26-
SubmissionPublisher<Integer> sp = new SubmissionPublisher<>();
27-
28-
ForkJoinPool.commonPool().submit(() -> {
29-
while (sp.getNumberOfSubscribers() == 0) {
30-
try {
31-
Thread.sleep(1);
32-
} catch (InterruptedException ex) {
33-
return;
27+
public Flow.Publisher<Integer> createFlowPublisher(final long elements) {
28+
final SubmissionPublisher<Integer> sp = new SubmissionPublisher<Integer>();
29+
30+
ForkJoinPool.commonPool().submit(new Runnable() {
31+
@Override
32+
public void run() {
33+
while (sp.getNumberOfSubscribers() == 0) {
34+
try {
35+
Thread.sleep(1);
36+
} catch (InterruptedException ex) {
37+
return;
38+
}
3439
}
35-
}
3640

37-
for (int i = 0; i < elements; i++) {
38-
sp.submit(i);
39-
}
41+
for (int i = 0; i < elements; i++) {
42+
sp.submit(i);
43+
}
4044

41-
sp.close();
45+
sp.close();
46+
}
4247
});
4348

4449
return sp;
4550
}
4651

4752
@Override
4853
public Flow.Publisher<Integer> createFailedFlowPublisher() {
49-
SubmissionPublisher<Integer> sp = new SubmissionPublisher<>();
54+
SubmissionPublisher<Integer> sp = new SubmissionPublisher<Integer>();
5055
sp.closeExceptionally(new Exception());
5156
return sp;
5257
}

0 commit comments

Comments
 (0)