diff --git a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheDecoderTest.java b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheDecoderTest.java index ca43e1dce7..c70f534075 100644 --- a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheDecoderTest.java +++ b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheDecoderTest.java @@ -22,15 +22,15 @@ import io.netty.handler.codec.memcache.LastMemcacheContent; import io.netty.handler.codec.memcache.MemcacheContent; import io.netty.util.CharsetUtil; import io.netty.util.ReferenceCounted; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.nullValue; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * Verifies the correct functionality of the {@link AbstractBinaryMemcacheDecoder}. @@ -69,12 +69,12 @@ public class BinaryMemcacheDecoderTest { private EmbeddedChannel channel; - @Before + @BeforeEach public void setup() throws Exception { channel = new EmbeddedChannel(new BinaryMemcacheRequestDecoder()); } - @After + @AfterEach public void teardown() throws Exception { channel.finishAndReleaseAll(); } diff --git a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheEncoderTest.java b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheEncoderTest.java index 032f17377f..fdbfa377ff 100644 --- a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheEncoderTest.java +++ b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheEncoderTest.java @@ -22,13 +22,15 @@ import io.netty.handler.codec.EncoderException; import io.netty.handler.codec.memcache.DefaultLastMemcacheContent; import io.netty.handler.codec.memcache.DefaultMemcacheContent; import io.netty.util.CharsetUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.jupiter.api.Assertions.assertThrows; /** * Verifies the correct functionality of the {@link AbstractBinaryMemcacheEncoder}. @@ -39,13 +41,13 @@ public class BinaryMemcacheEncoderTest { private EmbeddedChannel channel; - @Before - public void setup() throws Exception { + @BeforeEach + public void setup() { channel = new EmbeddedChannel(new BinaryMemcacheRequestEncoder()); } - @After - public void teardown() throws Exception { + @AfterEach + public void teardown() { channel.finishAndReleaseAll(); } @@ -153,9 +155,14 @@ public class BinaryMemcacheEncoderTest { written.release(); } - @Test(expected = EncoderException.class) + @Test public void shouldFailWithoutLastContent() { channel.writeOutbound(new DefaultMemcacheContent(Unpooled.EMPTY_BUFFER)); - channel.writeOutbound(new DefaultBinaryMemcacheRequest()); + assertThrows(EncoderException.class, new Executable() { + @Override + public void execute() { + channel.writeOutbound(new DefaultBinaryMemcacheRequest()); + } + }); } } diff --git a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheMessageTest.java b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheMessageTest.java index 9a18c4bbe9..e8e4f14942 100644 --- a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheMessageTest.java +++ b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheMessageTest.java @@ -18,9 +18,9 @@ package io.netty.handler.codec.memcache.binary; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.util.CharsetUtil; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class BinaryMemcacheMessageTest { diff --git a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheObjectAggregatorTest.java b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheObjectAggregatorTest.java index ec2dff7b6c..79a58c6152 100644 --- a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheObjectAggregatorTest.java +++ b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheObjectAggregatorTest.java @@ -21,14 +21,14 @@ import io.netty.channel.embedded.EmbeddedChannel; import io.netty.handler.codec.memcache.DefaultLastMemcacheContent; import io.netty.handler.codec.memcache.DefaultMemcacheContent; import io.netty.util.CharsetUtil; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.nullValue; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * Verifies the correct functionality of the {@link BinaryMemcacheObjectAggregator}. diff --git a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/DefaultFullBinaryMemcacheRequestTest.java b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/DefaultFullBinaryMemcacheRequestTest.java index f161a96252..6abe252f08 100644 --- a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/DefaultFullBinaryMemcacheRequestTest.java +++ b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/DefaultFullBinaryMemcacheRequestTest.java @@ -18,17 +18,17 @@ package io.netty.handler.codec.memcache.binary; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.util.CharsetUtil; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; public class DefaultFullBinaryMemcacheRequestTest { private DefaultFullBinaryMemcacheRequest request; - @Before + @BeforeEach public void setUp() { request = new DefaultFullBinaryMemcacheRequest( Unpooled.copiedBuffer("key", CharsetUtil.UTF_8), diff --git a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/DefaultFullBinaryMemcacheResponseTest.java b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/DefaultFullBinaryMemcacheResponseTest.java index dabe03e7f7..9a0882982a 100644 --- a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/DefaultFullBinaryMemcacheResponseTest.java +++ b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/DefaultFullBinaryMemcacheResponseTest.java @@ -18,17 +18,17 @@ package io.netty.handler.codec.memcache.binary; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.util.CharsetUtil; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotSame; public class DefaultFullBinaryMemcacheResponseTest { private DefaultFullBinaryMemcacheResponse response; - @Before + @BeforeEach public void setUp() { response = new DefaultFullBinaryMemcacheResponse( Unpooled.copiedBuffer("key", CharsetUtil.UTF_8), diff --git a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/FullMemcacheMessageRequestTest.java b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/FullMemcacheMessageRequestTest.java index 52bc22dd42..bff6c23f56 100644 --- a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/FullMemcacheMessageRequestTest.java +++ b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/FullMemcacheMessageRequestTest.java @@ -19,17 +19,19 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.embedded.EmbeddedChannel; import io.netty.util.CharsetUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class FullMemcacheMessageRequestTest { private EmbeddedChannel channel; - @Before + @BeforeEach public void setup() throws Exception { channel = new EmbeddedChannel( new BinaryMemcacheRequestEncoder(), @@ -37,7 +39,7 @@ public class FullMemcacheMessageRequestTest { new BinaryMemcacheObjectAggregator(1024)); } - @After + @AfterEach public void teardown() throws Exception { assertFalse(channel.finish()); } diff --git a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/FullMemcacheMessageResponseTest.java b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/FullMemcacheMessageResponseTest.java index e3e1bc2760..2181e7620b 100644 --- a/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/FullMemcacheMessageResponseTest.java +++ b/codec-memcache/src/test/java/io/netty/handler/codec/memcache/binary/FullMemcacheMessageResponseTest.java @@ -19,19 +19,19 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.embedded.EmbeddedChannel; import io.netty.util.CharsetUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class FullMemcacheMessageResponseTest { private EmbeddedChannel channel; - @Before + @BeforeEach public void setup() throws Exception { channel = new EmbeddedChannel( new BinaryMemcacheResponseEncoder(), @@ -39,7 +39,7 @@ public class FullMemcacheMessageResponseTest { new BinaryMemcacheObjectAggregator(1024)); } - @After + @AfterEach public void teardown() throws Exception { assertFalse(channel.finish()); }