aboutsummaryrefslogtreecommitdiff
path: root/netty
diff options
context:
space:
mode:
authorCarl Mastrangelo <notcarl@google.com>2017-10-05 11:24:15 -0700
committerGitHub <noreply@github.com>2017-10-05 11:24:15 -0700
commit5e36a8deb51d008f699a70de8e375e535c642cce (patch)
tree8bb7b0b919725775ce173c73911142b0f8aa80f5 /netty
parent765a40c7e6ee91e531f612c9d5d828a9afdfa04c (diff)
downloadgrpc-grpc-java-5e36a8deb51d008f699a70de8e375e535c642cce.tar.gz
all: upgrade to JUnit 4.12
Diffstat (limited to 'netty')
-rw-r--r--netty/src/test/java/io/grpc/netty/NettyServerHandlerTest.java7
-rw-r--r--netty/src/test/java/io/grpc/netty/ProtocolNegotiatorsTest.java7
-rw-r--r--netty/src/test/java/io/grpc/netty/WriteQueueTest.java7
3 files changed, 17 insertions, 4 deletions
diff --git a/netty/src/test/java/io/grpc/netty/NettyServerHandlerTest.java b/netty/src/test/java/io/grpc/netty/NettyServerHandlerTest.java
index 98a0f7392..5ae27bd64 100644
--- a/netty/src/test/java/io/grpc/netty/NettyServerHandlerTest.java
+++ b/netty/src/test/java/io/grpc/netty/NettyServerHandlerTest.java
@@ -87,7 +87,9 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.TimeUnit;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.ArgumentCaptor;
@@ -103,6 +105,9 @@ import org.mockito.stubbing.Answer;
@RunWith(JUnit4.class)
public class NettyServerHandlerTest extends NettyHandlerTestBase<NettyServerHandler> {
+ @Rule
+ public final Timeout globalTimeout = Timeout.seconds(1);
+
private static final int STREAM_ID = 3;
@Mock
@@ -529,7 +534,7 @@ public class NettyServerHandlerTest extends NettyHandlerTestBase<NettyServerHand
assertFalse(channel().isActive());
}
- @Test(timeout = 1000)
+ @Test
public void keepAliveEnforcer_sendingDataResetsCounters() throws Exception {
permitKeepAliveWithoutCalls = false;
permitKeepAliveTimeInNanos = TimeUnit.HOURS.toNanos(1);
diff --git a/netty/src/test/java/io/grpc/netty/ProtocolNegotiatorsTest.java b/netty/src/test/java/io/grpc/netty/ProtocolNegotiatorsTest.java
index 888d0a949..08dfcbba5 100644
--- a/netty/src/test/java/io/grpc/netty/ProtocolNegotiatorsTest.java
+++ b/netty/src/test/java/io/grpc/netty/ProtocolNegotiatorsTest.java
@@ -63,6 +63,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.ArgumentCaptor;
@@ -74,6 +75,8 @@ public class ProtocolNegotiatorsTest {
@Override public void run() {}
};
+ @Rule public final Timeout globalTimeout = Timeout.seconds(5);
+
@Rule
public final ExpectedException thrown = ExpectedException.none();
@@ -303,7 +306,7 @@ public class ProtocolNegotiatorsTest {
ProtocolNegotiators.plaintext()));
}
- @Test(timeout = 5000)
+ @Test
public void httpProxy_completes() throws Exception {
DefaultEventLoopGroup elg = new DefaultEventLoopGroup(1);
// ProxyHandler is incompatible with EmbeddedChannel because when channelRegistered() is called
@@ -367,7 +370,7 @@ public class ProtocolNegotiatorsTest {
channel.close();
}
- @Test(timeout = 5000)
+ @Test
public void httpProxy_500() throws Exception {
DefaultEventLoopGroup elg = new DefaultEventLoopGroup(1);
// ProxyHandler is incompatible with EmbeddedChannel because when channelRegistered() is called
diff --git a/netty/src/test/java/io/grpc/netty/WriteQueueTest.java b/netty/src/test/java/io/grpc/netty/WriteQueueTest.java
index 72d0b8a13..719c160fc 100644
--- a/netty/src/test/java/io/grpc/netty/WriteQueueTest.java
+++ b/netty/src/test/java/io/grpc/netty/WriteQueueTest.java
@@ -33,7 +33,9 @@ import io.netty.channel.EventLoop;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mock;
@@ -45,6 +47,9 @@ import org.mockito.stubbing.Answer;
@RunWith(JUnit4.class)
public class WriteQueueTest {
+ @Rule
+ public final Timeout globalTimeout = Timeout.seconds(10);
+
private final Object lock = new Object();
@Mock
@@ -138,7 +143,7 @@ public class WriteQueueTest {
verify(channel, times(2)).flush();
}
- @Test(timeout = 10000)
+ @Test
public void concurrentWriteAndFlush() throws Throwable {
final WriteQueue queue = new WriteQueue(channel);
final CountDownLatch flusherStarted = new CountDownLatch(1);