Migrate transport-udt to junit5 (#11439)

Motivation:

We should update to use junit5 in all modules.

Modifications:

Adjust transport-udt tests to use junit5

Result:

Part of https://github.com/netty/netty/issues/10757
This commit is contained in:
Norman Maurer 2021-07-01 18:19:24 +02:00 committed by GitHub
parent bc206ff173
commit 8003ea8a03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 21 deletions

View File

@ -17,9 +17,9 @@
package io.netty.test.udt.nio; package io.netty.test.udt.nio;
import io.netty.channel.udt.nio.NioUdtByteAcceptorChannel; import io.netty.channel.udt.nio.NioUdtByteAcceptorChannel;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.junit.Assert.*; import static org.junit.jupiter.api.Assertions.assertFalse;
public class NioUdtByteAcceptorChannelTest extends AbstractUdtTest { public class NioUdtByteAcceptorChannelTest extends AbstractUdtTest {

View File

@ -17,9 +17,9 @@
package io.netty.test.udt.nio; package io.netty.test.udt.nio;
import io.netty.channel.udt.nio.NioUdtByteConnectorChannel; import io.netty.channel.udt.nio.NioUdtByteConnectorChannel;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.junit.Assert.*; import static org.junit.jupiter.api.Assertions.assertFalse;
public class NioUdtByteConnectorChannelTest extends AbstractUdtTest { public class NioUdtByteConnectorChannelTest extends AbstractUdtTest {

View File

@ -27,13 +27,16 @@ import io.netty.test.udt.util.EchoByteHandler;
import io.netty.test.udt.util.UnitHelp; import io.netty.test.udt.util.UnitHelp;
import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory; import io.netty.util.internal.logging.InternalLoggerFactory;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
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 NioUdtByteRendezvousChannelTest extends AbstractUdtTest { public class NioUdtByteRendezvousChannelTest extends AbstractUdtTest {
@ -50,7 +53,8 @@ public class NioUdtByteRendezvousChannelTest extends AbstractUdtTest {
/** /**
* verify basic echo byte rendezvous * verify basic echo byte rendezvous
*/ */
@Test(timeout = 10 * 1000) @Test
@Timeout(value = 10000, unit = TimeUnit.MILLISECONDS)
public void basicEcho() throws Exception { public void basicEcho() throws Exception {
final int messageSize = 64 * 1024; final int messageSize = 64 * 1024;

View File

@ -17,9 +17,9 @@
package io.netty.test.udt.nio; package io.netty.test.udt.nio;
import io.netty.channel.udt.nio.NioUdtMessageAcceptorChannel; import io.netty.channel.udt.nio.NioUdtMessageAcceptorChannel;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.junit.Assert.*; import static org.junit.jupiter.api.Assertions.assertFalse;
public class NioUdtMessageAcceptorChannelTest extends AbstractUdtTest { public class NioUdtMessageAcceptorChannelTest extends AbstractUdtTest {

View File

@ -17,9 +17,9 @@
package io.netty.test.udt.nio; package io.netty.test.udt.nio;
import io.netty.channel.udt.nio.NioUdtMessageConnectorChannel; import io.netty.channel.udt.nio.NioUdtMessageConnectorChannel;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.junit.Assert.*; import static org.junit.jupiter.api.Assertions.assertFalse;
public class NioUdtMessageConnectorChannelTest extends AbstractUdtTest { public class NioUdtMessageConnectorChannelTest extends AbstractUdtTest {

View File

@ -27,14 +27,17 @@ import io.netty.test.udt.util.EchoMessageHandler;
import io.netty.test.udt.util.UnitHelp; import io.netty.test.udt.util.UnitHelp;
import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory; import io.netty.util.internal.logging.InternalLoggerFactory;
import org.junit.Ignore; import org.junit.jupiter.api.Disabled;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
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 NioUdtMessageRendezvousChannelTest extends AbstractUdtTest { public class NioUdtMessageRendezvousChannelTest extends AbstractUdtTest {
@ -54,8 +57,9 @@ public class NioUdtMessageRendezvousChannelTest extends AbstractUdtTest {
* FIXME: Re-enable after making it pass on Windows without unncessary tight loop. * FIXME: Re-enable after making it pass on Windows without unncessary tight loop.
* https://github.com/netty/netty/issues/2853 * https://github.com/netty/netty/issues/2853
*/ */
@Test(timeout = 10 * 1000) @Test
@Ignore @Timeout(value = 10000, unit = TimeUnit.MILLISECONDS)
@Disabled
public void basicEcho() throws Exception { public void basicEcho() throws Exception {
final int messageSize = 64 * 1024; final int messageSize = 64 * 1024;

View File

@ -24,10 +24,11 @@ import io.netty.channel.udt.nio.NioUdtProvider;
import io.netty.channel.udt.nio.NioUdtMessageAcceptorChannel; import io.netty.channel.udt.nio.NioUdtMessageAcceptorChannel;
import io.netty.channel.udt.nio.NioUdtMessageConnectorChannel; import io.netty.channel.udt.nio.NioUdtMessageConnectorChannel;
import io.netty.channel.udt.nio.NioUdtMessageRendezvousChannel; import io.netty.channel.udt.nio.NioUdtMessageRendezvousChannel;
import org.junit.jupiter.api.Test;
import org.junit.Test; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.*; import static org.hamcrest.MatcherAssert.assertThat;
public class NioUdtProviderTest extends AbstractUdtTest { public class NioUdtProviderTest extends AbstractUdtTest {
@ -68,7 +69,7 @@ public class NioUdtProviderTest extends AbstractUdtTest {
assertNotNull(NioUdtProvider.channelUDT(nioUdtMessageRendezvousChannel)); assertNotNull(NioUdtProvider.channelUDT(nioUdtMessageRendezvousChannel));
// acceptor types // acceptor types
assertTrue(NioUdtProvider.BYTE_ACCEPTOR.newChannel() instanceof UdtServerChannel); assertThat(NioUdtProvider.BYTE_ACCEPTOR.newChannel(), instanceOf(UdtServerChannel.class));
assertTrue(NioUdtProvider.MESSAGE_ACCEPTOR.newChannel() instanceof UdtServerChannel); assertThat(NioUdtProvider.MESSAGE_ACCEPTOR.newChannel(), instanceOf(UdtServerChannel.class));
} }
} }