Replace deprecated Assert.assertThat(...) with MatcherAssert.assertThat(...) (#10699)
Motivation: junit deprecated Assert.assertThat(...) Modifications: Use MatcherAssert.assertThat(...) as replacement for deprecated method Result: Less deprecation warnings
This commit is contained in:
parent
0a70135be4
commit
3f2c5ccd46
@ -58,12 +58,12 @@ import static io.netty.buffer.Unpooled.unreleasableBuffer;
|
||||
import static io.netty.buffer.Unpooled.wrappedBuffer;
|
||||
import static io.netty.util.internal.EmptyArrays.EMPTY_BYTES;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assume.assumeFalse;
|
||||
|
@ -38,13 +38,13 @@ import static io.netty.buffer.Unpooled.wrappedBuffer;
|
||||
import static io.netty.util.internal.EmptyArrays.EMPTY_BYTES;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
|
@ -21,8 +21,8 @@ import org.junit.Test;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Random;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Tests wrapping a wrapped buffer does not go way too deep chaining.
|
||||
|
@ -32,6 +32,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static io.netty.buffer.Unpooled.unreleasableBuffer;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.*;
|
||||
|
@ -17,6 +17,7 @@
|
||||
import io.netty.util.CharsetUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -24,9 +24,9 @@ import org.junit.Test;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Queue;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class SimpleLeakAwareCompositeByteBufTest extends WrappedCompositeByteBufTest {
|
||||
|
@ -26,8 +26,8 @@ import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public class DnsQueryTest {
|
||||
|
||||
|
@ -27,8 +27,8 @@ import org.junit.rules.ExpectedException;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class DnsResponseTest {
|
||||
|
||||
|
@ -24,10 +24,10 @@ import java.util.Iterator;
|
||||
|
||||
import static io.netty.handler.codec.http.HttpHeaderNames.SET_COOKIE;
|
||||
import static io.netty.util.AsciiString.contentEquals;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class CombinedHttpHeadersTest {
|
||||
|
@ -29,6 +29,7 @@ import static io.netty.handler.codec.http.HttpHeadersTestUtils.of;
|
||||
import static io.netty.util.AsciiString.contentEquals;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class DefaultHttpHeadersTest {
|
||||
|
@ -45,6 +45,7 @@ import java.util.concurrent.CountDownLatch;
|
||||
import static io.netty.util.ReferenceCountUtil.release;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -30,6 +30,7 @@ import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class HttpContentCompressorTest {
|
||||
|
@ -39,6 +39,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class HttpContentDecoderTest {
|
||||
|
@ -35,6 +35,7 @@ import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class HttpContentEncoderTest {
|
||||
|
@ -22,9 +22,9 @@ import java.util.List;
|
||||
|
||||
import static io.netty.handler.codec.http.HttpHeadersTestUtils.of;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class HttpHeadersTest {
|
||||
|
@ -36,12 +36,12 @@ import java.util.List;
|
||||
import static io.netty.handler.codec.http.HttpHeadersTestUtils.of;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.assertSame;
|
||||
|
@ -29,11 +29,11 @@ import static io.netty.handler.codec.http.HttpHeadersTestUtils.of;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class HttpRequestDecoderTest {
|
||||
|
@ -28,6 +28,7 @@ import java.nio.ByteOrder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.*;
|
||||
|
@ -32,11 +32,11 @@ import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.CoreMatchers.sameInstance;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class HttpResponseDecoderTest {
|
||||
|
@ -25,6 +25,7 @@ import org.junit.Test;
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.WritableByteChannel;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -22,6 +22,7 @@ import io.netty.util.CharsetUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class HttpServerCodecTest {
|
||||
|
@ -20,6 +20,7 @@ import io.netty.util.ReferenceCountUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class HttpServerExpectContinueHandlerTest {
|
||||
|
@ -28,6 +28,7 @@ import java.util.TimeZone;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ClientCookieDecoderTest {
|
||||
|
@ -15,12 +15,13 @@
|
||||
*/
|
||||
package io.netty.handler.codec.http.cookie;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.matchers.JUnitMatchers.containsString;
|
||||
|
||||
import io.netty.handler.codec.DateFormatter;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
@ -19,9 +19,13 @@ import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertSame;
|
||||
|
||||
import static io.netty.handler.codec.http.websocketx.WebSocketCloseStatus.*;
|
||||
|
||||
public class WebSocketCloseStatusTest {
|
||||
@ -43,33 +47,33 @@ public class WebSocketCloseStatusTest {
|
||||
|
||||
@Test
|
||||
public void testToString() {
|
||||
Assert.assertEquals("1000 Bye", NORMAL_CLOSURE.toString());
|
||||
assertEquals("1000 Bye", NORMAL_CLOSURE.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testKnownStatuses() {
|
||||
Assert.assertSame(NORMAL_CLOSURE, valueOf(1000));
|
||||
Assert.assertSame(ENDPOINT_UNAVAILABLE, valueOf(1001));
|
||||
Assert.assertSame(PROTOCOL_ERROR, valueOf(1002));
|
||||
Assert.assertSame(INVALID_MESSAGE_TYPE, valueOf(1003));
|
||||
Assert.assertSame(INVALID_PAYLOAD_DATA, valueOf(1007));
|
||||
Assert.assertSame(POLICY_VIOLATION, valueOf(1008));
|
||||
Assert.assertSame(MESSAGE_TOO_BIG, valueOf(1009));
|
||||
Assert.assertSame(MANDATORY_EXTENSION, valueOf(1010));
|
||||
Assert.assertSame(INTERNAL_SERVER_ERROR, valueOf(1011));
|
||||
Assert.assertSame(SERVICE_RESTART, valueOf(1012));
|
||||
Assert.assertSame(TRY_AGAIN_LATER, valueOf(1013));
|
||||
Assert.assertSame(BAD_GATEWAY, valueOf(1014));
|
||||
assertSame(NORMAL_CLOSURE, valueOf(1000));
|
||||
assertSame(ENDPOINT_UNAVAILABLE, valueOf(1001));
|
||||
assertSame(PROTOCOL_ERROR, valueOf(1002));
|
||||
assertSame(INVALID_MESSAGE_TYPE, valueOf(1003));
|
||||
assertSame(INVALID_PAYLOAD_DATA, valueOf(1007));
|
||||
assertSame(POLICY_VIOLATION, valueOf(1008));
|
||||
assertSame(MESSAGE_TOO_BIG, valueOf(1009));
|
||||
assertSame(MANDATORY_EXTENSION, valueOf(1010));
|
||||
assertSame(INTERNAL_SERVER_ERROR, valueOf(1011));
|
||||
assertSame(SERVICE_RESTART, valueOf(1012));
|
||||
assertSame(TRY_AGAIN_LATER, valueOf(1013));
|
||||
assertSame(BAD_GATEWAY, valueOf(1014));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNaturalOrder() {
|
||||
Assert.assertThat(PROTOCOL_ERROR, Matchers.greaterThan(NORMAL_CLOSURE));
|
||||
Assert.assertThat(PROTOCOL_ERROR, Matchers.greaterThan(valueOf(1001)));
|
||||
Assert.assertThat(PROTOCOL_ERROR, Matchers.comparesEqualTo(PROTOCOL_ERROR));
|
||||
Assert.assertThat(PROTOCOL_ERROR, Matchers.comparesEqualTo(valueOf(1002)));
|
||||
Assert.assertThat(PROTOCOL_ERROR, Matchers.lessThan(INVALID_MESSAGE_TYPE));
|
||||
Assert.assertThat(PROTOCOL_ERROR, Matchers.lessThan(valueOf(1007)));
|
||||
assertThat(PROTOCOL_ERROR, Matchers.greaterThan(NORMAL_CLOSURE));
|
||||
assertThat(PROTOCOL_ERROR, Matchers.greaterThan(valueOf(1001)));
|
||||
assertThat(PROTOCOL_ERROR, Matchers.comparesEqualTo(PROTOCOL_ERROR));
|
||||
assertThat(PROTOCOL_ERROR, Matchers.comparesEqualTo(valueOf(1002)));
|
||||
assertThat(PROTOCOL_ERROR, Matchers.lessThan(INVALID_MESSAGE_TYPE));
|
||||
assertThat(PROTOCOL_ERROR, Matchers.lessThan(valueOf(1007)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -79,13 +83,13 @@ public class WebSocketCloseStatusTest {
|
||||
WebSocketCloseStatus untradablePrice = new WebSocketCloseStatus(6034, "Untradable price");
|
||||
|
||||
// Then
|
||||
Assert.assertNotSame(feedTimeot, valueOf(6033));
|
||||
Assert.assertEquals(feedTimeot.code(), 6033);
|
||||
Assert.assertEquals(feedTimeot.reasonText(), "Feed timed out");
|
||||
assertNotSame(feedTimeot, valueOf(6033));
|
||||
assertEquals(feedTimeot.code(), 6033);
|
||||
assertEquals(feedTimeot.reasonText(), "Feed timed out");
|
||||
|
||||
Assert.assertNotSame(untradablePrice, valueOf(6034));
|
||||
Assert.assertEquals(untradablePrice.code(), 6034);
|
||||
Assert.assertEquals(untradablePrice.reasonText(), "Untradable price");
|
||||
assertNotSame(untradablePrice, valueOf(6034));
|
||||
assertEquals(untradablePrice.code(), 6034);
|
||||
assertEquals(untradablePrice.reasonText(), "Untradable price");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -116,12 +120,11 @@ public class WebSocketCloseStatusTest {
|
||||
}
|
||||
|
||||
// Then
|
||||
Assert.assertEquals(0, invalidCodes.first().intValue());
|
||||
Assert.assertEquals(2999, invalidCodes.last().intValue());
|
||||
Assert.assertEquals(3000 - validCodes.size(), invalidCodes.size());
|
||||
assertEquals(0, invalidCodes.first().intValue());
|
||||
assertEquals(2999, invalidCodes.last().intValue());
|
||||
assertEquals(3000 - validCodes.size(), invalidCodes.size());
|
||||
|
||||
invalidCodes.retainAll(knownCodes);
|
||||
Assert.assertEquals(invalidCodes, Collections.emptySet());
|
||||
assertEquals(invalidCodes, Collections.emptySet());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import org.junit.Test;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static io.netty.util.CharsetUtil.UTF_8;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
|
@ -33,12 +33,16 @@ import io.netty.handler.codec.http.HttpServerCodec;
|
||||
import io.netty.util.ReferenceCountUtil;
|
||||
import io.netty.util.ReferenceCounted;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import static io.netty.handler.codec.http.HttpVersion.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class WebSocketServerHandshaker13Test extends WebSocketServerHandshakerTest {
|
||||
|
||||
@ -74,7 +78,7 @@ public class WebSocketServerHandshaker13Test extends WebSocketServerHandshakerTe
|
||||
testUpgrade0(ch, new WebSocketServerHandshaker13(
|
||||
"ws://example.com/chat", null, false, Integer.MAX_VALUE, false));
|
||||
}
|
||||
Assert.assertFalse(ch.finish());
|
||||
assertFalse(ch.finish());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -98,14 +102,14 @@ public class WebSocketServerHandshaker13Test extends WebSocketServerHandshakerTe
|
||||
ByteBuf buffer = ch.readOutbound();
|
||||
try {
|
||||
ch.writeInbound(buffer);
|
||||
Assert.fail();
|
||||
fail();
|
||||
} catch (CorruptedWebSocketFrameException expected) {
|
||||
// expected
|
||||
}
|
||||
ReferenceCounted closeMessage = ch.readOutbound();
|
||||
Assert.assertThat(closeMessage, CoreMatchers.instanceOf(ByteBuf.class));
|
||||
assertThat(closeMessage, CoreMatchers.instanceOf(ByteBuf.class));
|
||||
closeMessage.release();
|
||||
Assert.assertFalse(ch.finish());
|
||||
assertFalse(ch.finish());
|
||||
}
|
||||
|
||||
private static void testUpgrade0(EmbeddedChannel ch, WebSocketServerHandshaker13 handshaker) {
|
||||
@ -126,14 +130,14 @@ public class WebSocketServerHandshaker13Test extends WebSocketServerHandshakerTe
|
||||
ch2.writeInbound(resBuf);
|
||||
HttpResponse res = ch2.readInbound();
|
||||
|
||||
Assert.assertEquals(
|
||||
assertEquals(
|
||||
"s3pPLMBiTxaQ9kYGzzhZRbK+xOo=", res.headers().get(HttpHeaderNames.SEC_WEBSOCKET_ACCEPT));
|
||||
Iterator<String> subProtocols = handshaker.subprotocols().iterator();
|
||||
if (subProtocols.hasNext()) {
|
||||
Assert.assertEquals(subProtocols.next(),
|
||||
assertEquals(subProtocols.next(),
|
||||
res.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL));
|
||||
} else {
|
||||
Assert.assertNull(res.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL));
|
||||
assertNull(res.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL));
|
||||
}
|
||||
ReferenceCountUtil.release(res);
|
||||
req.release();
|
||||
|
@ -44,10 +44,11 @@ import static io.netty.handler.codec.http2.Http2Stream.State.OPEN;
|
||||
import static io.netty.handler.codec.http2.Http2Stream.State.RESERVED_REMOTE;
|
||||
import static io.netty.util.CharsetUtil.UTF_8;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.any;
|
||||
|
@ -50,12 +50,12 @@ import static io.netty.handler.codec.http2.Http2Stream.State.HALF_CLOSED_REMOTE;
|
||||
import static io.netty.handler.codec.http2.Http2Stream.State.RESERVED_LOCAL;
|
||||
import static io.netty.handler.codec.http2.Http2TestUtil.newVoidPromise;
|
||||
import static io.netty.util.CharsetUtil.UTF_8;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.any;
|
||||
|
@ -45,9 +45,9 @@ import static io.netty.util.AsciiString.EMPTY_STRING;
|
||||
import static io.netty.util.AsciiString.of;
|
||||
import static java.lang.Integer.MAX_VALUE;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
@ -19,8 +19,8 @@ import org.junit.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
@ -61,12 +61,12 @@ import static io.netty.handler.codec.http2.Http2TestUtil.anyChannelPromise;
|
||||
import static io.netty.handler.codec.http2.Http2TestUtil.anyHttp2Settings;
|
||||
import static io.netty.handler.codec.http2.Http2TestUtil.assertEqualsAndRelease;
|
||||
import static io.netty.handler.codec.http2.Http2TestUtil.bb;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.any;
|
||||
|
@ -44,9 +44,9 @@ import java.util.concurrent.ExecutionException;
|
||||
import static io.netty.handler.codec.http2.Http2FrameCodecBuilder.forClient;
|
||||
import static io.netty.handler.codec.http2.Http2FrameCodecBuilder.forServer;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
@ -54,9 +54,9 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
|
@ -27,8 +27,8 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.core.IsEqual.equalTo;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Verifies the correct functionality of the {@link AbstractBinaryMemcacheEncoder}.
|
||||
|
@ -30,6 +30,7 @@ import java.util.List;
|
||||
|
||||
import static io.netty.handler.codec.redis.RedisCodecTestUtil.*;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
|
@ -27,6 +27,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import static io.netty.handler.codec.redis.RedisCodecTestUtil.*;
|
||||
|
@ -22,6 +22,7 @@ import io.netty.util.ReferenceCountUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import static io.netty.buffer.Unpooled.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -24,7 +24,7 @@ import java.util.Random;
|
||||
|
||||
import static io.netty.buffer.Unpooled.*;
|
||||
import static org.hamcrest.core.Is.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
public class ByteArrayDecoderTest {
|
||||
|
||||
|
@ -26,7 +26,7 @@ import java.util.Random;
|
||||
|
||||
import static io.netty.buffer.Unpooled.*;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
public class ByteArrayEncoderTest {
|
||||
|
||||
|
@ -29,6 +29,7 @@ import org.junit.Test;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -20,6 +20,7 @@ import io.netty.buffer.CompositeByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.embedded.EmbeddedChannel;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -49,13 +49,13 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.zip.Checksum;
|
||||
|
||||
import static io.netty.handler.codec.compression.Lz4Constants.DEFAULT_SEED;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.core.Is.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class Lz4FrameEncoderTest extends AbstractEncoderTest {
|
||||
|
@ -23,6 +23,7 @@ import org.junit.Test;
|
||||
import static io.netty.buffer.Unpooled.*;
|
||||
import static org.hamcrest.core.Is.*;
|
||||
import static org.hamcrest.core.IsNull.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ProtobufVarint32FrameDecoderTest {
|
||||
|
@ -22,6 +22,7 @@ import org.junit.Test;
|
||||
|
||||
import static io.netty.buffer.Unpooled.*;
|
||||
import static org.hamcrest.core.Is.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ProtobufVarint32LengthFieldPrependerTest {
|
||||
|
@ -37,7 +37,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
public class XmlFrameDecoderTest {
|
||||
|
||||
|
@ -30,11 +30,11 @@ import static io.netty.util.CharsetUtil.UTF_16BE;
|
||||
import static io.netty.util.CharsetUtil.UTF_16LE;
|
||||
import static io.netty.util.CharsetUtil.UTF_8;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
public class ConstantPoolTest {
|
||||
|
||||
|
@ -23,12 +23,12 @@ import java.util.concurrent.BrokenBarrierException;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasToString;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class NettyRuntimeTests {
|
||||
|
@ -24,8 +24,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class ThreadDeathWatcherTest {
|
||||
|
@ -38,6 +38,7 @@ import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static java.lang.Math.max;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.lessThan;
|
||||
import static org.junit.Assert.*;
|
||||
|
@ -25,10 +25,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class FastThreadLocalTest {
|
||||
|
@ -27,8 +27,8 @@ import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.CoreMatchers.sameInstance;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public class GlobalEventExecutorTest {
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
package io.netty.util.concurrent;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import org.junit.Rule;
|
||||
|
@ -35,6 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class SingleThreadEventExecutorTest {
|
||||
|
@ -32,12 +32,12 @@ import static io.netty.util.internal.StringUtil.toHexStringPadded;
|
||||
import static io.netty.util.internal.StringUtil.unescapeCsv;
|
||||
import static io.netty.util.internal.StringUtil.unescapeCsvFields;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class StringUtilTest {
|
||||
|
@ -38,8 +38,8 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
final class HttpProxyServer extends ProxyServer {
|
||||
|
||||
|
@ -69,6 +69,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.Random;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
|
@ -34,8 +34,8 @@ import io.netty.util.internal.SocketUtils;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
final class Socks4ProxyServer extends ProxyServer {
|
||||
|
||||
|
@ -43,8 +43,8 @@ import io.netty.util.internal.SocketUtils;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
final class Socks5ProxyServer extends ProxyServer {
|
||||
|
||||
|
@ -43,8 +43,8 @@ import static io.netty.util.internal.StringUtil.NEWLINE;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.CoreMatchers.sameInstance;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.slf4j.Logger.ROOT_LOGGER_NAME;
|
||||
|
||||
|
@ -20,6 +20,7 @@ import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.sameInstance;
|
||||
import static org.junit.Assert.*;
|
||||
|
@ -22,6 +22,7 @@ import org.junit.Test;
|
||||
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class OpenSslCachingKeyMaterialProviderTest extends OpenSslKeyMaterialProviderTest {
|
||||
|
@ -66,10 +66,10 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static io.netty.handler.ssl.OpenSslTestUtils.checkShouldUseKeyManagerFactory;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
|
@ -19,11 +19,11 @@ package io.netty.handler.ssl;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
@ -93,12 +93,12 @@ import javax.net.ssl.X509ExtendedTrustManager;
|
||||
|
||||
import static io.netty.buffer.Unpooled.wrappedBuffer;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
@ -18,8 +18,8 @@ package io.netty.handler.timeout;
|
||||
import org.junit.Test;
|
||||
|
||||
import static io.netty.handler.timeout.IdleStateEvent.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.hasToString;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class IdleStateEventTest {
|
||||
@Test
|
||||
|
@ -18,12 +18,15 @@ package io.netty.resolver.dns.macos;
|
||||
import io.netty.resolver.dns.DnsServerAddressStream;
|
||||
import io.netty.resolver.dns.DnsServerAddressStreamProvider;
|
||||
import io.netty.resolver.dns.DnsServerAddressStreamProviders;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Assume;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class MacOSDnsServerAddressStreamProviderTest {
|
||||
|
||||
@BeforeClass
|
||||
@ -35,18 +38,18 @@ public class MacOSDnsServerAddressStreamProviderTest {
|
||||
public void testStream() {
|
||||
DnsServerAddressStreamProvider provider = new MacOSDnsServerAddressStreamProvider();
|
||||
DnsServerAddressStream stream = provider.nameServerAddressStream("netty.io");
|
||||
Assert.assertNotNull(stream);
|
||||
Assert.assertNotEquals(0, stream.size());
|
||||
assertNotNull(stream);
|
||||
assertNotEquals(0, stream.size());
|
||||
|
||||
for (int i = 0; i < stream.size(); i++) {
|
||||
Assert.assertNotEquals(0, stream.next().getPort());
|
||||
assertNotEquals(0, stream.next().getPort());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultUseCorrectInstance() {
|
||||
Assert.assertThat(DnsServerAddressStreamProviders.platformDefault(),
|
||||
Matchers.instanceOf(MacOSDnsServerAddressStreamProvider.class));
|
||||
assertThat(DnsServerAddressStreamProviders.platformDefault(),
|
||||
instanceOf(MacOSDnsServerAddressStreamProvider.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,13 +24,15 @@ import io.netty.resolver.AddressResolver;
|
||||
import io.netty.util.concurrent.Future;
|
||||
import io.netty.util.concurrent.FutureListener;
|
||||
import io.netty.util.concurrent.Promise;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.channels.UnsupportedAddressTypeException;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class DnsAddressResolverGroupTest {
|
||||
@Test
|
||||
public void testUseConfiguredEventLoop() throws InterruptedException {
|
||||
@ -49,8 +51,9 @@ public class DnsAddressResolverGroupTest {
|
||||
@Override
|
||||
public void operationComplete(Future<Object> future) {
|
||||
try {
|
||||
Assert.assertThat(future.cause(), Matchers.instanceOf(UnsupportedAddressTypeException.class));
|
||||
Assert.assertTrue(loop.inEventLoop());
|
||||
assertThat(future.cause(),
|
||||
instanceOf(UnsupportedAddressTypeException.class));
|
||||
assertTrue(loop.inEventLoop());
|
||||
promise.setSuccess(null);
|
||||
} catch (Throwable cause) {
|
||||
promise.setFailure(cause);
|
||||
|
@ -113,6 +113,7 @@ import static io.netty.handler.codec.dns.DnsRecordType.AAAA;
|
||||
import static io.netty.handler.codec.dns.DnsRecordType.CNAME;
|
||||
import static io.netty.resolver.dns.DnsServerAddresses.sequential;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
@ -123,7 +124,6 @@ import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
|
@ -25,8 +25,8 @@ import java.util.IdentityHashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import static io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider.defaultAddressList;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class DnsServerAddressesTest {
|
||||
|
||||
|
@ -34,12 +34,12 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.core.StringContains.containsString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class SearchDomainTest {
|
||||
|
@ -32,6 +32,7 @@ import java.net.ConnectException;
|
||||
import java.net.Socket;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.*;
|
||||
import static io.netty.testsuite.transport.socket.SocketTestPermutation.BAD_HOST;
|
||||
|
@ -39,6 +39,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class SocketFileRegionTest extends AbstractSocketTest {
|
||||
|
@ -58,13 +58,13 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import javax.net.ssl.SSLEngine;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.sameInstance;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class SocketSslEchoTest extends AbstractSocketTest {
|
||||
|
@ -60,7 +60,7 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
|
@ -27,6 +27,7 @@ import java.nio.ByteBuffer;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static io.netty.buffer.Unpooled.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -28,7 +28,7 @@ import java.io.ObjectOutputStream;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.CoreMatchers.sameInstance;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@SuppressWarnings("DynamicRegexReplaceableByCompiledPattern")
|
||||
|
@ -28,6 +28,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -25,6 +25,7 @@ import org.junit.Test;
|
||||
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ReentrantChannelTest extends BaseChannelTest {
|
||||
|
@ -41,6 +41,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -55,10 +55,10 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
|
@ -28,7 +28,6 @@ import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import io.netty.util.IntSupplier;
|
||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||
import io.netty.util.concurrent.Future;
|
||||
import org.hamcrest.core.IsInstanceOf;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -42,6 +41,8 @@ import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class NioEventLoopTest extends AbstractEventLoopTest {
|
||||
@ -188,7 +189,7 @@ public class NioEventLoopTest extends AbstractEventLoopTest {
|
||||
group.shutdownNow();
|
||||
t.join();
|
||||
group.terminationFuture().syncUninterruptibly();
|
||||
assertThat(error.get(), IsInstanceOf.instanceOf(RejectedExecutionException.class));
|
||||
assertThat(error.get(), instanceOf(RejectedExecutionException.class));
|
||||
error.set(null);
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user