This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new fe7311c  Replace Junit with testng (#3675)
fe7311c is described below

commit fe7311c637181cf6545e73fee066d9a2840b0a59
Author: Like <like_0...@163.com>
AuthorDate: Tue Feb 26 00:23:01 2019 +0800

    Replace Junit with testng (#3675)
    
    Closes #3663
---
 .../pulsar/client/api/DeadLetterTopicTest.java     |  4 +--
 .../apache/pulsar/client/api/InterceptorsTest.java |  2 +-
 .../pulsar/PulsarAvroOutputFormatTest.java         | 13 +++----
 .../pulsar/PulsarCsvOutputFormatTest.java          | 12 +++----
 .../pulsar/PulsarJsonOutputFormatTest.java         | 12 +++----
 .../connectors/pulsar/PulsarOutputFormatTest.java  | 16 ++++-----
 .../serialization/AvroSerializationSchemaTest.java |  4 +--
 .../serialization/CsvSerializationSchemaTest.java  |  4 +--
 .../serialization/JsonSerializationSchemaTest.java |  6 ++--
 .../connectors/pulsar/PulsarAvroTableSinkTest.java | 14 ++++----
 .../pulsar/PulsarConsumerSourceTests.java          | 13 ++++---
 .../connectors/pulsar/PulsarJsonTableSinkTest.java | 10 +++---
 .../connectors/pulsar/PulsarSourceBuilderTest.java | 32 ++++++++---------
 .../pulsar/functions/instance/ContextImplTest.java | 40 ++++++++++++----------
 .../instance/state/StateContextImplTest.java       | 19 +++++-----
 .../pulsar/functions/runtime/RuntimeUtilsTest.java |  8 ++---
 .../io/debezium/PulsarDatabaseHistoryTest.java     |  2 +-
 pulsar-io/netty/pom.xml                            |  6 ++--
 .../pulsar/io/netty/NettySourceConfigTest.java     | 10 +++---
 .../http/NettyHttpChannelInitializerTest.java      |  6 ++--
 .../netty/server/NettyChannelInitializerTest.java  |  6 ++--
 .../pulsar/io/netty/server/NettyServerTest.java    | 21 ++++++------
 .../pulsar/tests/integration/cli/CLITest.java      |  1 -
 .../integration/functions/PulsarStateTest.java     |  4 +--
 .../tests/integration/io/CassandraSinkTester.java  |  4 +--
 25 files changed, 137 insertions(+), 132 deletions(-)

diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java
index 22177ba..ca2eadb 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java
@@ -26,8 +26,8 @@ import org.testng.annotations.Test;
 
 import java.util.concurrent.TimeUnit;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertNotNull;
 
 public class DeadLetterTopicTest extends ProducerConsumerBase {
 
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/InterceptorsTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/InterceptorsTest.java
index d833846..36d35a3 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/InterceptorsTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/InterceptorsTest.java
@@ -21,9 +21,9 @@ package org.apache.pulsar.client.api;
 import org.apache.pulsar.client.impl.MessageImpl;
 import org.apache.pulsar.client.impl.TopicMessageImpl;
 import org.apache.pulsar.common.api.proto.PulsarApi;
-import org.junit.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
diff --git 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarAvroOutputFormatTest.java
 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarAvroOutputFormatTest.java
index 7013006..62c3b5d 100644
--- 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarAvroOutputFormatTest.java
+++ 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarAvroOutputFormatTest.java
@@ -18,31 +18,32 @@
  */
 package org.apache.flink.batch.connectors.pulsar;
 
-import org.junit.Test;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertNotNull;
 
-import static org.junit.Assert.assertNotNull;
 
 /**
  * Tests for Pulsar Avro Output Format
  */
 public class PulsarAvroOutputFormatTest {
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarAvroOutputFormatConstructorWhenServiceUrlIsNull() {
         new PulsarAvroOutputFormat(null, "testTopic");
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarAvroOutputFormatConstructorWhenTopicNameIsNull() {
         new PulsarAvroOutputFormat("testServiceUrl", null);
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarAvroOutputFormatConstructorWhenTopicNameIsBlank() {
         new PulsarAvroOutputFormat("testServiceUrl", " ");
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarAvroOutputFormatConstructorWhenServiceUrlIsBlank() {
         new PulsarAvroOutputFormat(" ", "testTopic");
     }
diff --git 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarCsvOutputFormatTest.java
 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarCsvOutputFormatTest.java
index 175c224..a564a89 100644
--- 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarCsvOutputFormatTest.java
+++ 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarCsvOutputFormatTest.java
@@ -18,31 +18,31 @@
  */
 package org.apache.flink.batch.connectors.pulsar;
 
-import org.junit.Test;
+import org.testng.annotations.Test;
 
-import static org.junit.Assert.assertNotNull;
+import static org.testng.Assert.assertNotNull;
 
 /**
  * Tests for Pulsar Csv Output Format
  */
 public class PulsarCsvOutputFormatTest {
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarCsvOutputFormatConstructorWhenServiceUrlIsNull() {
         new PulsarCsvOutputFormat(null, "testTopic");
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarCsvOutputFormatConstructorWhenTopicNameIsNull() {
         new PulsarCsvOutputFormat("testServiceUrl", null);
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarCsvOutputFormatConstructorWhenTopicNameIsBlank() {
         new PulsarCsvOutputFormat("testServiceUrl", " ");
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarCsvOutputFormatConstructorWhenServiceUrlIsBlank() {
         new PulsarCsvOutputFormat(" ", "testTopic");
     }
diff --git 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarJsonOutputFormatTest.java
 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarJsonOutputFormatTest.java
index 4a10273..b9953cf 100644
--- 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarJsonOutputFormatTest.java
+++ 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarJsonOutputFormatTest.java
@@ -18,31 +18,31 @@
  */
 package org.apache.flink.batch.connectors.pulsar;
 
-import org.junit.Test;
+import org.testng.annotations.Test;
 
-import static org.junit.Assert.assertNotNull;
+import static org.testng.Assert.assertNotNull;
 
 /**
  * Tests for Pulsar Json Output Format
  */
 public class PulsarJsonOutputFormatTest {
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarJsonOutputFormatConstructorWhenServiceUrlIsNull() {
         new PulsarJsonOutputFormat(null, "testTopic");
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarJsonOutputFormatConstructorWhenTopicNameIsNull() {
         new PulsarJsonOutputFormat("testServiceUrl", null);
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarJsonOutputFormatConstructorWhenTopicNameIsBlank() {
         new PulsarJsonOutputFormat("testServiceUrl", " ");
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarJsonOutputFormatConstructorWhenServiceUrlIsBlank() {
         new PulsarJsonOutputFormat(" ", "testTopic");
     }
diff --git 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarOutputFormatTest.java
 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarOutputFormatTest.java
index 9da4de0..41cf8b2 100644
--- 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarOutputFormatTest.java
+++ 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/PulsarOutputFormatTest.java
@@ -20,40 +20,40 @@ package org.apache.flink.batch.connectors.pulsar;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.flink.api.common.serialization.SerializationSchema;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
 
 /**
  * Tests for Pulsar Output Format
  */
 public class PulsarOutputFormatTest {
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarOutputFormatConstructorWhenServiceUrlIsNull() {
         new PulsarOutputFormat(null, "testTopic", text -> 
text.toString().getBytes());
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarOutputFormatConstructorWhenTopicNameIsNull() {
         new PulsarOutputFormat("testServiceUrl", null, text -> 
text.toString().getBytes());
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarOutputFormatConstructorWhenTopicNameIsBlank() {
         new PulsarOutputFormat("testServiceUrl", " ", text -> 
text.toString().getBytes());
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testPulsarOutputFormatConstructorWhenServiceUrlIsBlank() {
         new PulsarOutputFormat(" ", "testTopic", text -> 
text.toString().getBytes());
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void 
testPulsarOutputFormatConstructorWhenSerializationSchemaIsNull() {
         new PulsarOutputFormat("testServiceUrl", "testTopic", null);
     }
diff --git 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/AvroSerializationSchemaTest.java
 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/AvroSerializationSchemaTest.java
index 4f8f0c6..48d0435 100644
--- 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/AvroSerializationSchemaTest.java
+++ 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/AvroSerializationSchemaTest.java
@@ -21,11 +21,11 @@ package 
org.apache.flink.batch.connectors.pulsar.serialization;
 import org.apache.avro.generic.GenericRecord;
 import org.apache.flink.avro.generated.NasaMission;
 import org.apache.flink.formats.avro.AvroDeserializationSchema;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
 import java.io.IOException;
 
-import static org.junit.Assert.assertEquals;
+import static org.testng.Assert.assertEquals;
 
 /**
  * Tests for Avro Serialization Schema
diff --git 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/CsvSerializationSchemaTest.java
 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/CsvSerializationSchemaTest.java
index 1c8764b..3666e54 100644
--- 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/CsvSerializationSchemaTest.java
+++ 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/CsvSerializationSchemaTest.java
@@ -20,12 +20,12 @@ package 
org.apache.flink.batch.connectors.pulsar.serialization;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.flink.api.java.tuple.Tuple3;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 
-import static org.junit.Assert.assertEquals;
+import static org.testng.Assert.assertEquals;
 
 /**
  * Tests for Csv Serialization Schema
diff --git 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/JsonSerializationSchemaTest.java
 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/JsonSerializationSchemaTest.java
index fded6c3..80a1cd8 100644
--- 
a/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/JsonSerializationSchemaTest.java
+++ 
b/pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/serialization/JsonSerializationSchemaTest.java
@@ -19,12 +19,12 @@
 package org.apache.flink.batch.connectors.pulsar.serialization;
 
 import org.apache.commons.io.IOUtils;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 
-import static org.junit.Assert.assertEquals;
+import static org.testng.Assert.assertEquals;
 
 /**
  * Tests for Json Serialization Schema
@@ -49,7 +49,7 @@ public class JsonSerializationSchemaTest {
         assertEquals(jsonContent, "{\"id\":0,\"name\":null}");
     }
 
-    @Test(expected = RuntimeException.class)
+    @Test(expectedExceptions = RuntimeException.class)
     public void testJsonSerializationSchemaWithNotSerializableObject() {
         NotSerializableObject notSerializableObject = new 
NotSerializableObject();
         JsonSerializationSchema schema = new JsonSerializationSchema();
diff --git 
a/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarAvroTableSinkTest.java
 
b/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarAvroTableSinkTest.java
index ca79153..85bb2ed 100644
--- 
a/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarAvroTableSinkTest.java
+++ 
b/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarAvroTableSinkTest.java
@@ -25,11 +25,13 @@ import org.apache.flink.streaming.api.datastream.DataStream;
 import 
org.apache.flink.streaming.connectors.pulsar.partitioner.PulsarKeyExtractor;
 import org.apache.flink.table.sinks.TableSink;
 import org.apache.flink.types.Row;
-import org.junit.Assert;
-import org.junit.Test;
 import org.mockito.Mockito;
 import org.mockito.internal.util.reflection.Whitebox;
 import org.powermock.api.mockito.PowerMockito;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
 
 /**
  * Unit test of {@link PulsarAvroTableSink}.
@@ -58,10 +60,10 @@ public class PulsarAvroTableSinkTest {
 
         TableSink<Row> configuredSink = sink.configure(fieldNames, 
typeInformations);
 
-        Assert.assertArrayEquals(fieldNames, configuredSink.getFieldNames());
-        Assert.assertArrayEquals(typeInformations, 
configuredSink.getFieldTypes());
-        Assert.assertNotNull(((PulsarAvroTableSink) 
configuredSink).keyExtractor);
-        Assert.assertNotNull(((PulsarAvroTableSink) 
configuredSink).serializationSchema);
+        assertArrayEquals(fieldNames, configuredSink.getFieldNames());
+        assertArrayEquals(typeInformations, configuredSink.getFieldTypes());
+        assertNotNull(((PulsarAvroTableSink) configuredSink).keyExtractor);
+        assertNotNull(((PulsarAvroTableSink) 
configuredSink).serializationSchema);
     }
 
 
diff --git 
a/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarConsumerSourceTests.java
 
b/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarConsumerSourceTests.java
index e20b0f1..a6bcc3a 100644
--- 
a/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarConsumerSourceTests.java
+++ 
b/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarConsumerSourceTests.java
@@ -30,7 +30,6 @@ import org.apache.flink.streaming.api.operators.StreamSource;
 import org.apache.flink.streaming.api.operators.StreamingRuntimeContext;
 import org.apache.flink.streaming.api.watermark.Watermark;
 import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
-
 import org.apache.pulsar.client.api.Consumer;
 import org.apache.pulsar.client.api.ConsumerStats;
 import org.apache.pulsar.client.api.Message;
@@ -40,11 +39,11 @@ import org.apache.pulsar.client.api.PulsarClientException;
 import org.apache.pulsar.client.api.Schema;
 import org.apache.pulsar.client.impl.MessageImpl;
 import org.apache.pulsar.shade.io.netty.buffer.Unpooled;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
 import org.mockito.Mockito;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import java.util.ArrayDeque;
 import java.util.ArrayList;
@@ -82,7 +81,7 @@ public class PulsarConsumerSourceTests {
 
     private Exception exception;
 
-    @Before
+    @BeforeMethod
     public void before() {
         context = new TestSourceContext();
 
@@ -95,7 +94,7 @@ public class PulsarConsumerSourceTests {
         });
     }
 
-    @After
+    @AfterMethod
     public void after() throws Exception {
         if (source != null) {
             source.cancel();
diff --git 
a/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarJsonTableSinkTest.java
 
b/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarJsonTableSinkTest.java
index 49927ce..9ceefff 100644
--- 
a/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarJsonTableSinkTest.java
+++ 
b/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarJsonTableSinkTest.java
@@ -24,11 +24,13 @@ import org.apache.flink.streaming.api.datastream.DataStream;
 import 
org.apache.flink.streaming.connectors.pulsar.partitioner.PulsarKeyExtractor;
 import org.apache.flink.table.sinks.TableSink;
 import org.apache.flink.types.Row;
-import org.junit.Assert;
-import org.junit.Test;
 import org.mockito.Mockito;
 import org.mockito.internal.util.reflection.Whitebox;
 import org.powermock.api.mockito.PowerMockito;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
 
 /**
  * Unit test of {@link PulsarJsonTableSink}.
@@ -55,8 +57,8 @@ public class PulsarJsonTableSinkTest {
 
         TableSink<Row> configuredSink = sink.configure(fieldNames, 
typeInformations);
 
-        Assert.assertArrayEquals(fieldNames, configuredSink.getFieldNames());
-        Assert.assertArrayEquals(typeInformations, 
configuredSink.getFieldTypes());
+        assertArrayEquals(fieldNames, configuredSink.getFieldNames());
+        assertArrayEquals(typeInformations, configuredSink.getFieldTypes());
         Assert.assertNotNull(((PulsarJsonTableSink) 
configuredSink).keyExtractor);
         Assert.assertNotNull(((PulsarJsonTableSink) 
configuredSink).serializationSchema);
     }
diff --git 
a/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarSourceBuilderTest.java
 
b/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarSourceBuilderTest.java
index b6b159d..4f59b6e 100644
--- 
a/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarSourceBuilderTest.java
+++ 
b/pulsar-flink/src/test/java/org/apache/flink/streaming/connectors/pulsar/PulsarSourceBuilderTest.java
@@ -21,9 +21,9 @@ package org.apache.flink.streaming.connectors.pulsar;
 import org.apache.flink.api.common.serialization.DeserializationSchema;
 import org.apache.flink.api.common.typeinfo.TypeInformation;
 import org.apache.flink.streaming.api.functions.source.SourceFunction;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.util.Arrays;
@@ -36,7 +36,7 @@ public class PulsarSourceBuilderTest {
 
     private PulsarSourceBuilder pulsarSourceBuilder;
 
-    @Before
+    @BeforeMethod
     public void before() {
         pulsarSourceBuilder = PulsarSourceBuilder.builder(new 
TestDeserializationSchema());
     }
@@ -51,63 +51,63 @@ public class PulsarSourceBuilderTest {
         Assert.assertNotNull(sourceFunction);
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testBuildWithoutSettingRequiredProperties() {
         pulsarSourceBuilder.build();
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testServiceUrlWithNull() {
         pulsarSourceBuilder.serviceUrl(null);
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testServiceUrlWithBlank() {
         pulsarSourceBuilder.serviceUrl(" ");
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testTopicWithNull() {
         pulsarSourceBuilder.topic(null);
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testTopicWithBlank() {
         pulsarSourceBuilder.topic(" ");
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testTopicsWithNull() {
         pulsarSourceBuilder.topics(null);
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testTopicsWithBlank() {
         pulsarSourceBuilder.topics(Arrays.asList(" ", " "));
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testTopicPatternWithNull() {
         pulsarSourceBuilder.topicsPattern(null);
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testTopicPatternAlreadySet() {
         
pulsarSourceBuilder.topicsPattern(Pattern.compile("persistent://tenants/ns/topic-*"));
         
pulsarSourceBuilder.topicsPattern(Pattern.compile("persistent://tenants/ns/topic-my-*"));
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testTopicPattenStringWithNull() {
         pulsarSourceBuilder.topicsPatternString(null);
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testSubscriptionNameWithNull() {
         pulsarSourceBuilder.subscriptionName(null);
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testSubscriptionNameWithBlank() {
         pulsarSourceBuilder.subscriptionName(" ");
     }
diff --git 
a/pulsar-functions/instance/src/test/java/org/apache/pulsar/functions/instance/ContextImplTest.java
 
b/pulsar-functions/instance/src/test/java/org/apache/pulsar/functions/instance/ContextImplTest.java
index 278cd5a..47c3539 100644
--- 
a/pulsar-functions/instance/src/test/java/org/apache/pulsar/functions/instance/ContextImplTest.java
+++ 
b/pulsar-functions/instance/src/test/java/org/apache/pulsar/functions/instance/ContextImplTest.java
@@ -18,18 +18,6 @@
  */
 package org.apache.pulsar.functions.instance;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Optional;
-import java.util.concurrent.CompletableFuture;
-
 import io.prometheus.client.CollectorRegistry;
 import org.apache.pulsar.client.api.Producer;
 import org.apache.pulsar.client.api.Schema;
@@ -40,10 +28,24 @@ import 
org.apache.pulsar.functions.instance.state.StateContextImpl;
 import org.apache.pulsar.functions.proto.Function.FunctionDetails;
 import 
org.apache.pulsar.functions.secretsprovider.EnvironmentBasedSecretsProvider;
 import org.apache.pulsar.functions.utils.Utils;
-import org.junit.Before;
-import org.junit.Test;
 import org.mockito.Matchers;
 import org.slf4j.Logger;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.same;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 /**
  * Unit test {@link ContextImpl}.
@@ -56,7 +58,7 @@ public class ContextImplTest {
     private ContextImpl context;
     private Producer producer = mock(Producer.class);
 
-    @Before
+    @BeforeMethod
     public void setup() {
         config = new InstanceConfig();
         FunctionDetails functionDetails = FunctionDetails.newBuilder()
@@ -80,22 +82,22 @@ public class ContextImplTest {
                 Utils.ComponentType.FUNCTION);
     }
 
-    @Test(expected = IllegalStateException.class)
+    @Test(expectedExceptions = IllegalStateException.class)
     public void testIncrCounterStateDisabled() {
         context.incrCounter("test-key", 10);
     }
 
-    @Test(expected = IllegalStateException.class)
+    @Test(expectedExceptions = IllegalStateException.class)
     public void testGetCounterStateDisabled() {
         context.getCounter("test-key");
     }
 
-    @Test(expected = IllegalStateException.class)
+    @Test(expectedExceptions = IllegalStateException.class)
     public void testPutStateStateDisabled() {
         context.putState("test-key", 
ByteBuffer.wrap("test-value".getBytes(UTF_8)));
     }
 
-    @Test(expected = IllegalStateException.class)
+    @Test(expectedExceptions = IllegalStateException.class)
     public void testGetStateStateDisabled() {
         context.getState("test-key");
     }
diff --git 
a/pulsar-functions/instance/src/test/java/org/apache/pulsar/functions/instance/state/StateContextImplTest.java
 
b/pulsar-functions/instance/src/test/java/org/apache/pulsar/functions/instance/state/StateContextImplTest.java
index afe0403..338f64e 100644
--- 
a/pulsar-functions/instance/src/test/java/org/apache/pulsar/functions/instance/state/StateContextImplTest.java
+++ 
b/pulsar-functions/instance/src/test/java/org/apache/pulsar/functions/instance/state/StateContextImplTest.java
@@ -18,6 +18,15 @@
  */
 package org.apache.pulsar.functions.instance.state;
 
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import org.apache.bookkeeper.api.kv.Table;
+import org.apache.bookkeeper.common.concurrent.FutureUtils;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.nio.ByteBuffer;
+
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyLong;
@@ -28,14 +37,6 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 import static org.testng.AssertJUnit.assertEquals;
 
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import java.nio.ByteBuffer;
-import org.apache.bookkeeper.api.kv.Table;
-import org.apache.bookkeeper.common.concurrent.FutureUtils;
-import org.junit.Before;
-import org.junit.Test;
-
 /**
  * Unit test {@link StateContextImpl}.
  */
@@ -44,7 +45,7 @@ public class StateContextImplTest {
     private Table<ByteBuf, ByteBuf> mockTable;
     private StateContextImpl stateContext;
 
-    @Before
+    @BeforeMethod
     public void setup() {
         this.mockTable = mock(Table.class);
         this.stateContext = new StateContextImpl(mockTable);
diff --git 
a/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/RuntimeUtilsTest.java
 
b/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/RuntimeUtilsTest.java
index 431afcf..5d78599 100644
--- 
a/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/RuntimeUtilsTest.java
+++ 
b/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/RuntimeUtilsTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.pulsar.functions.runtime;
 
-import org.junit.Assert;
 import org.testng.annotations.Test;
 
 import java.util.function.Supplier;
@@ -28,6 +27,7 @@ import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertEquals;
 
 public class RuntimeUtilsTest {
 
@@ -68,7 +68,7 @@ public class RuntimeUtilsTest {
                 .addAction(action2);
         actions.run();
 
-        Assert.assertEquals(actions.numActions(), 2);
+        assertEquals(actions.numActions(), 2);
         verify(supplier1, times(1)).get();
         verify(onFail, times(0)).run();
         verify(onSucess, times(1)).run();
@@ -111,7 +111,7 @@ public class RuntimeUtilsTest {
                 .addAction(action2);
         actions.run();
 
-        Assert.assertEquals(actions.numActions(), 2);
+        assertEquals(actions.numActions(), 2);
         verify(supplier1, times(1)).get();
         verify(onFail, times(0)).run();
         verify(onSucess, times(1)).run();
@@ -152,7 +152,7 @@ public class RuntimeUtilsTest {
                 .addAction(action2);
         actions.run();
 
-        Assert.assertEquals(actions.numActions(), 2);
+        assertEquals(actions.numActions(), 2);
         verify(supplier1, times(10)).get();
         verify(onFail, times(1)).run();
         verify(onSucess, times(0)).run();
diff --git 
a/pulsar-io/debezium/src/test/java/org/apache/pulsar/io/debezium/PulsarDatabaseHistoryTest.java
 
b/pulsar-io/debezium/src/test/java/org/apache/pulsar/io/debezium/PulsarDatabaseHistoryTest.java
index e3b4fd9..db75437 100644
--- 
a/pulsar-io/debezium/src/test/java/org/apache/pulsar/io/debezium/PulsarDatabaseHistoryTest.java
+++ 
b/pulsar-io/debezium/src/test/java/org/apache/pulsar/io/debezium/PulsarDatabaseHistoryTest.java
@@ -18,7 +18,7 @@
  */
 package org.apache.pulsar.io.debezium;
 
-import static org.junit.Assert.assertEquals;
+import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 
diff --git a/pulsar-io/netty/pom.xml b/pulsar-io/netty/pom.xml
index 1ca1cd4..6aa8d64 100644
--- a/pulsar-io/netty/pom.xml
+++ b/pulsar-io/netty/pom.xml
@@ -66,9 +66,9 @@
         </dependency>
 
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.12</version>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>6.13.1</version>
             <scope>test</scope>
         </dependency>
 
diff --git 
a/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/NettySourceConfigTest.java
 
b/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/NettySourceConfigTest.java
index 034fa79..5b5b188 100644
--- 
a/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/NettySourceConfigTest.java
+++ 
b/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/NettySourceConfigTest.java
@@ -19,15 +19,15 @@
 package org.apache.pulsar.io.netty;
 
 import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
 import java.io.File;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
 
 /**
  * Tests for Netty Tcp or Udp Source Config
@@ -53,7 +53,7 @@ public class NettySourceConfigTest {
         assertEquals(1, nettySourceConfig.getNumberOfThreads());
     }
 
-    @Test(expected = UnrecognizedPropertyException.class)
+    @Test(expectedExceptions = UnrecognizedPropertyException.class)
     public void testNettyTcpConfigLoadWithMapWhenInvalidPropertyIsSet() throws 
IOException {
         Map<String, Object> map = new HashMap<>();
         map.put("invalidProperty", 1);
@@ -72,7 +72,7 @@ public class NettySourceConfigTest {
         assertEquals(5, nettySourceConfig.getNumberOfThreads());
     }
 
-    @Test(expected = UnrecognizedPropertyException.class)
+    @Test(expectedExceptions = UnrecognizedPropertyException.class)
     public void testNettyTcpConfigLoadWithYamlFileWhenInvalidPropertyIsSet() 
throws IOException {
         File yamlFile = getFile("nettySourceConfigWithInvalidProperty.yaml");
         NettySourceConfig.load(yamlFile.getAbsolutePath());
diff --git 
a/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/http/NettyHttpChannelInitializerTest.java
 
b/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/http/NettyHttpChannelInitializerTest.java
index eae087b..760c333 100644
--- 
a/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/http/NettyHttpChannelInitializerTest.java
+++ 
b/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/http/NettyHttpChannelInitializerTest.java
@@ -20,10 +20,10 @@ package org.apache.pulsar.io.netty.http;
 
 import io.netty.channel.socket.nio.NioSocketChannel;
 import org.apache.pulsar.io.netty.NettySource;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
 
 /**
  * Tests for Netty Channel Initializer
diff --git 
a/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/server/NettyChannelInitializerTest.java
 
b/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/server/NettyChannelInitializerTest.java
index b8d6dd4..7fb3b45 100644
--- 
a/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/server/NettyChannelInitializerTest.java
+++ 
b/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/server/NettyChannelInitializerTest.java
@@ -20,10 +20,10 @@ package org.apache.pulsar.io.netty.server;
 
 import io.netty.channel.socket.nio.NioSocketChannel;
 import org.apache.pulsar.io.netty.NettySource;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
 
 /**
  * Tests for Netty Channel Initializer
diff --git 
a/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/server/NettyServerTest.java
 
b/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/server/NettyServerTest.java
index 8041570..40b3f93 100644
--- 
a/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/server/NettyServerTest.java
+++ 
b/pulsar-io/netty/src/test/java/org/apache/pulsar/io/netty/server/NettyServerTest.java
@@ -20,14 +20,13 @@ package org.apache.pulsar.io.netty.server;
 
 import org.apache.pulsar.io.netty.NettySource;
 import org.apache.pulsar.io.netty.NettySourceConfig;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.testng.Assert.assertNotNull;
 
 /**
  * Tests for Netty Tcp or Udp Server
@@ -86,7 +85,7 @@ public class NettyServerTest {
         assertNotNull(nettyTcpServer);
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testNettyTcpServerConstructorWhenHostIsNotSet() {
         new NettyServer.Builder()
                 .setType(NettyServer.Type.valueOf(TCP))
@@ -96,7 +95,7 @@ public class NettyServerTest {
                 .build();
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testNettyTcpServerConstructorWhenPortIsNotSet() {
         new NettyServer.Builder()
                 .setType(NettyServer.Type.valueOf(TCP))
@@ -106,7 +105,7 @@ public class NettyServerTest {
                 .build();
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testNettyTcpServerConstructorWhenNumberOfThreadsIsNotSet() {
         new NettyServer.Builder()
                 .setType(NettyServer.Type.valueOf(TCP))
@@ -116,7 +115,7 @@ public class NettyServerTest {
                 .build();
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testNettyTcpServerConstructorWhenNettyTcpSourceIsNotSet() {
         new NettyServer.Builder()
                 .setType(NettyServer.Type.valueOf(TCP))
@@ -126,7 +125,7 @@ public class NettyServerTest {
                 .build();
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testNettyTcpServerWhenHostIsSetAsBlank() {
         new NettyServer.Builder()
                 .setType(NettyServer.Type.valueOf(TCP))
@@ -137,7 +136,7 @@ public class NettyServerTest {
                 .build();
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testNettyTcpServerWhenPortIsSetAsZero() {
         new NettyServer.Builder()
                 .setType(NettyServer.Type.valueOf(TCP))
@@ -148,7 +147,7 @@ public class NettyServerTest {
                 .build();
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testNettyTcpServerWhenPortIsSetLowerThan1024() {
         new NettyServer.Builder()
                 .setType(NettyServer.Type.valueOf(TCP))
@@ -159,7 +158,7 @@ public class NettyServerTest {
                 .build();
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testNettyTcpServerWhenNumberOfThreadsIsSetAsZero() {
         new NettyServer.Builder()
                 .setType(NettyServer.Type.valueOf(TCP))
diff --git 
a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/CLITest.java
 
b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/CLITest.java
index ce876d4..3995ebf 100644
--- 
a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/CLITest.java
+++ 
b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/CLITest.java
@@ -35,7 +35,6 @@ import org.testng.annotations.Test;
 
 import java.util.concurrent.TimeUnit;
 
-import static org.junit.Assert.assertThat;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
diff --git 
a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarStateTest.java
 
b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarStateTest.java
index eeefd6e..264e9bc 100644
--- 
a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarStateTest.java
+++ 
b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarStateTest.java
@@ -19,9 +19,9 @@
 package org.apache.pulsar.tests.integration.functions;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
+import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
-import static org.testng.AssertJUnit.fail;
+import static org.testng.Assert.fail;
 
 import lombok.Cleanup;
 import org.apache.pulsar.client.api.Consumer;
diff --git 
a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/io/CassandraSinkTester.java
 
b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/io/CassandraSinkTester.java
index 3309358..7265072 100644
--- 
a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/io/CassandraSinkTester.java
+++ 
b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/io/CassandraSinkTester.java
@@ -30,8 +30,8 @@ import java.util.List;
 import java.util.Map;
 
 import static 
org.apache.pulsar.tests.integration.topologies.PulsarClusterTestBase.randomName;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertEquals;
 
 /**
  * A tester for testing cassandra sink.

Reply via email to