KAFKA-12196: Migrate connect:api module to JUnit 5 (#9909)

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Ismael Juma <ismael@juma.me.uk>
This commit is contained in:
Geordie 2021-01-18 11:17:47 +08:00 committed by GitHub
parent 962b69b5b3
commit 462be6da9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 154 additions and 208 deletions

View File

@ -242,7 +242,7 @@ subprojects {
}
// Remove the relevant project name once it's converted to JUnit 5
def shouldUseJUnit5 = !(["api", "connect", "core", "generator", "runtime", "examples",
def shouldUseJUnit5 = !(["connect", "core", "generator", "runtime", "examples",
"streams-scala", "streams"].contains(it.project.name) || it.project.name.startsWith("upgrade-system-tests-"))
def testLoggingEvents = ["passed", "skipped", "failed"]
@ -1850,9 +1850,7 @@ project(':connect:api') {
compile libs.slf4jApi
compile libs.jaxrsApi
testCompile libs.junitJupiterApi
testCompile libs.junitVintageEngine
testCompile libs.junitJupiter
testRuntime libs.slf4jlog4j
testCompile project(':clients').sourceSets.test.output
}

View File

@ -19,14 +19,14 @@ package org.apache.kafka.connect.connector;
import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.connect.errors.ConnectException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class ConnectorReconfigurationTest {

View File

@ -21,8 +21,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public abstract class ConnectorTest {
@ -30,7 +30,7 @@ public abstract class ConnectorTest {
protected Connector connector;
protected AssertableConnector assertableConnector;
@Before
@BeforeEach
public void beforeEach() {
connector = createConnector();
context = createContext();

View File

@ -17,7 +17,7 @@
package org.apache.kafka.connect.data;
import org.apache.kafka.connect.errors.DataException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import java.math.BigInteger;
@ -28,10 +28,10 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class ConnectSchemaTest {
private static final Schema MAP_INT_STRING_SCHEMA = SchemaBuilder.map(Schema.INT32_SCHEMA, Schema.STRING_SCHEMA).build();
@ -69,8 +69,7 @@ public class ConnectSchemaTest {
@Test
public void testFieldsOnlyValidForStructs() {
assertThrows(DataException.class,
() -> Schema.INT8_SCHEMA.fields());
assertThrows(DataException.class, Schema.INT8_SCHEMA::fields);
}
@Test

View File

@ -17,14 +17,14 @@
package org.apache.kafka.connect.data;
import org.apache.kafka.connect.errors.DataException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class DateTest {
private static final GregorianCalendar EPOCH;

View File

@ -16,14 +16,14 @@
*/
package org.apache.kafka.connect.data;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collections;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class DecimalTest {
private static final int TEST_SCALE = 2;

View File

@ -16,10 +16,10 @@
*/
package org.apache.kafka.connect.data;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
public class FieldTest {

View File

@ -17,7 +17,7 @@
package org.apache.kafka.connect.data;
import org.apache.kafka.connect.errors.SchemaBuilderException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.nio.ByteBuffer;
import java.util.Arrays;
@ -26,9 +26,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class SchemaBuilderTest {
private static final String NAME = "name";

View File

@ -19,7 +19,7 @@ package org.apache.kafka.connect.data;
import org.apache.kafka.connect.data.Schema.Type;
import org.apache.kafka.connect.errors.DataException;
import org.apache.kafka.connect.errors.SchemaProjectorException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import java.math.BigInteger;
@ -29,10 +29,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class SchemaProjectorTest {
@ -58,26 +59,14 @@ public class SchemaProjectorTest {
projected = SchemaProjector.project(Schema.STRING_SCHEMA, "abc", Schema.OPTIONAL_STRING_SCHEMA);
assertEquals("abc", projected);
try {
SchemaProjector.project(Schema.OPTIONAL_BOOLEAN_SCHEMA, false, Schema.BOOLEAN_SCHEMA);
fail("Cannot project optional schema to schema with no default value.");
} catch (DataException e) {
// expected
}
assertThrows(DataException.class, () -> SchemaProjector.project(Schema.OPTIONAL_BOOLEAN_SCHEMA, false,
Schema.BOOLEAN_SCHEMA), "Cannot project optional schema to schema with no default value.");
try {
SchemaProjector.project(Schema.OPTIONAL_BYTES_SCHEMA, bytes, Schema.BYTES_SCHEMA);
fail("Cannot project optional schema to schema with no default value.");
} catch (DataException e) {
// expected
}
assertThrows(DataException.class, () -> SchemaProjector.project(Schema.OPTIONAL_BYTES_SCHEMA, bytes,
Schema.BYTES_SCHEMA), "Cannot project optional schema to schema with no default value.");
try {
SchemaProjector.project(Schema.OPTIONAL_STRING_SCHEMA, "abc", Schema.STRING_SCHEMA);
fail("Cannot project optional schema to schema with no default value.");
} catch (DataException e) {
// expected
}
assertThrows(DataException.class, () -> SchemaProjector.project(Schema.OPTIONAL_STRING_SCHEMA, "abc",
Schema.STRING_SCHEMA), "Cannot project optional schema to schema with no default value.");
}
@Test
@ -137,12 +126,9 @@ public class SchemaProjectorTest {
for (Schema promotableSchema: promotableSchemas) {
for (Schema nonPromotableSchema: nonPromotableSchemas) {
Object dummy = new Object();
try {
SchemaProjector.project(promotableSchema, dummy, nonPromotableSchema);
fail("Cannot promote " + promotableSchema.type() + " to " + nonPromotableSchema.type());
} catch (DataException e) {
// expected
}
assertThrows(DataException.class, () -> SchemaProjector.project(promotableSchema, dummy, nonPromotableSchema),
"Cannot promote " + promotableSchema.type() + " to " + nonPromotableSchema.type());
}
}
}
@ -224,7 +210,6 @@ public class SchemaProjectorTest {
Struct targetStruct = (Struct) SchemaProjector.project(source, sourceStruct, target);
assertEquals(1, (int) targetStruct.getInt32("field"));
assertEquals(123, (int) targetStruct.getInt32("field2"));
@ -233,12 +218,8 @@ public class SchemaProjectorTest {
.field("field2", Schema.INT32_SCHEMA)
.build();
try {
SchemaProjector.project(source, sourceStruct, incompatibleTargetSchema);
fail("Incompatible schema.");
} catch (DataException e) {
// expected
}
assertThrows(DataException.class, () -> SchemaProjector.project(source, sourceStruct, incompatibleTargetSchema),
"Incompatible schema.");
}
@Test
@ -257,12 +238,8 @@ public class SchemaProjectorTest {
Struct targetStruct = (Struct) SchemaProjector.project(source, sourceStruct, target);
assertEquals(1, targetStruct.get("field"));
try {
targetStruct.get("field2");
fail("field2 is not part of the projected struct");
} catch (DataException e) {
// expected
}
assertThrows(DataException.class, () -> targetStruct.get("field2"),
"field2 is not part of the projected struct");
}
@Test
@ -367,26 +344,14 @@ public class SchemaProjectorTest {
Schema namedSchema = SchemaBuilder.int32().name("invalidLogicalTypeName").build();
for (Schema logicalTypeSchema: logicalTypeSchemas) {
try {
SchemaProjector.project(logicalTypeSchema, null, Schema.BOOLEAN_SCHEMA);
fail("Cannot project logical types to non-logical types.");
} catch (SchemaProjectorException e) {
// expected
}
assertThrows(SchemaProjectorException.class, () -> SchemaProjector.project(logicalTypeSchema, null,
Schema.BOOLEAN_SCHEMA), "Cannot project logical types to non-logical types.");
try {
SchemaProjector.project(logicalTypeSchema, null, namedSchema);
fail("Reader name is not a valid logical type name.");
} catch (SchemaProjectorException e) {
// expected
}
assertThrows(SchemaProjectorException.class, () -> SchemaProjector.project(logicalTypeSchema, null,
namedSchema), "Reader name is not a valid logical type name.");
try {
SchemaProjector.project(Schema.BOOLEAN_SCHEMA, null, logicalTypeSchema);
fail("Cannot project non-logical types to logical types.");
} catch (SchemaProjectorException e) {
// expected
}
assertThrows(SchemaProjectorException.class, () -> SchemaProjector.project(Schema.BOOLEAN_SCHEMA,
null, logicalTypeSchema), "Cannot project non-logical types to logical types.");
}
}
@ -412,20 +377,13 @@ public class SchemaProjectorTest {
assertEquals(Arrays.asList(1L, 2L, 3L), projected);
Schema noDefaultValueTarget = SchemaBuilder.array(Schema.INT32_SCHEMA).build();
try {
SchemaProjector.project(optionalSource, null, noDefaultValueTarget);
fail("Target schema does not provide a default value.");
} catch (SchemaProjectorException e) {
// expected
}
assertThrows(SchemaProjectorException.class, () -> SchemaProjector.project(optionalSource, null,
noDefaultValueTarget), "Target schema does not provide a default value.");
Schema nonPromotableTarget = SchemaBuilder.array(Schema.BOOLEAN_SCHEMA).build();
try {
SchemaProjector.project(optionalSource, null, nonPromotableTarget);
fail("Neither source type matches target type nor source type can be promoted to target type");
} catch (SchemaProjectorException e) {
// expected
}
assertThrows(SchemaProjectorException.class,
() -> SchemaProjector.project(optionalSource, null, nonPromotableTarget),
"Neither source type matches target type nor source type can be promoted to target type");
}
@Test
@ -446,20 +404,14 @@ public class SchemaProjectorTest {
assertEquals(Collections.singletonMap(3L, 4.5F), projected);
Schema noDefaultValueTarget = SchemaBuilder.map(Schema.INT32_SCHEMA, Schema.INT32_SCHEMA).build();
try {
SchemaProjector.project(source, null, noDefaultValueTarget);
fail("Reader does not provide a default value.");
} catch (SchemaProjectorException e) {
// expected
}
assertThrows(SchemaProjectorException.class,
() -> SchemaProjector.project(source, null, noDefaultValueTarget),
"Reader does not provide a default value.");
Schema nonPromotableTarget = SchemaBuilder.map(Schema.BOOLEAN_SCHEMA, Schema.STRING_SCHEMA).build();
try {
SchemaProjector.project(source, null, nonPromotableTarget);
fail("Neither source type matches target type nor source type can be promoted to target type");
} catch (SchemaProjectorException e) {
// expected
}
assertThrows(SchemaProjectorException.class,
() -> SchemaProjector.project(source, null, nonPromotableTarget),
"Neither source type matches target type nor source type can be promoted to target type");
}
@Test
@ -467,20 +419,14 @@ public class SchemaProjectorTest {
Schema source = SchemaBuilder.int32().name("source").build();
Schema target = SchemaBuilder.int32().name("target").build();
try {
SchemaProjector.project(source, 12, target);
fail("Source name and target name mismatch.");
} catch (SchemaProjectorException e) {
// expected
}
assertThrows(SchemaProjectorException.class,
() -> SchemaProjector.project(source, 12, target),
"Source name and target name mismatch.");
Schema targetWithParameters = SchemaBuilder.int32().parameters(Collections.singletonMap("key", "value"));
try {
SchemaProjector.project(source, 34, targetWithParameters);
fail("Source parameters and target parameters mismatch.");
} catch (SchemaProjectorException e) {
// expected
}
assertThrows(SchemaProjectorException.class,
() -> SchemaProjector.project(source, 34, targetWithParameters),
"Source parameters and target parameters mismatch.");
}
@Test
@ -506,8 +452,9 @@ public class SchemaProjectorTest {
private void verifyOptionalProjection(Schema source, Type targetType, Object value, Object defaultValue, Object expectedProjected, boolean optional) {
Schema target;
assert source.isOptional();
assert value != null;
assertTrue(source.isOptional());
assertNotNull(value);
if (optional) {
target = SchemaBuilder.type(targetType).optional().defaultValue(defaultValue).build();
} else {

View File

@ -18,7 +18,7 @@ package org.apache.kafka.connect.data;
import org.apache.kafka.connect.errors.DataException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.nio.ByteBuffer;
import java.util.Arrays;
@ -26,10 +26,10 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class StructTest {

View File

@ -17,14 +17,14 @@
package org.apache.kafka.connect.data;
import org.apache.kafka.connect.errors.DataException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class TimeTest {
private static final GregorianCalendar EPOCH;

View File

@ -17,14 +17,14 @@
package org.apache.kafka.connect.data;
import org.apache.kafka.connect.errors.DataException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class TimestampTest {
private static final GregorianCalendar EPOCH;

View File

@ -19,7 +19,8 @@ package org.apache.kafka.connect.data;
import org.apache.kafka.connect.data.Schema.Type;
import org.apache.kafka.connect.data.Values.Parser;
import org.apache.kafka.connect.errors.DataException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import java.math.BigDecimal;
import java.math.BigInteger;
@ -33,13 +34,13 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
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.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
public class ValuesTest {
@ -77,7 +78,8 @@ public class ValuesTest {
INT_LIST.add(-987654321);
}
@Test(timeout = 5000)
@Test
@Timeout(5)
public void shouldNotEncounterInfiniteLoop() {
// This byte sequence gets parsed as CharacterIterator.DONE and can cause issues if
// comparisons to that character are done to check if the end of a string has been reached.

View File

@ -20,20 +20,20 @@ import org.apache.kafka.connect.data.Schema;
import org.apache.kafka.connect.data.SchemaAndValue;
import org.apache.kafka.connect.data.SchemaBuilder;
import org.apache.kafka.connect.data.Struct;
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.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
public class ConnectHeaderTest {
private String key;
private ConnectHeader header;
@Before
@BeforeEach
public void beforeEach() {
key = "key";
withString("value");

View File

@ -28,8 +28,8 @@ import org.apache.kafka.connect.data.Timestamp;
import org.apache.kafka.connect.data.Values;
import org.apache.kafka.connect.errors.DataException;
import org.apache.kafka.connect.header.Headers.HeaderTransform;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import java.math.RoundingMode;
@ -42,15 +42,15 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.TimeZone;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
public class ConnectHeadersTest {
@ -72,7 +72,7 @@ public class ConnectHeadersTest {
private String key;
private String other;
@Before
@BeforeEach
public void beforeEach() {
headers = new ConnectHeaders();
key = "k1";

View File

@ -24,9 +24,9 @@ import org.apache.kafka.connect.connector.ConnectorContext;
import org.apache.kafka.connect.connector.ConnectorTest;
import org.apache.kafka.connect.connector.Task;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class SinkConnectorTest extends ConnectorTest {

View File

@ -22,16 +22,16 @@ import org.apache.kafka.connect.data.Values;
import org.apache.kafka.connect.header.ConnectHeaders;
import org.apache.kafka.connect.header.Header;
import org.apache.kafka.connect.header.Headers;
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.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
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.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class SinkRecordTest {
@ -43,7 +43,7 @@ public class SinkRecordTest {
private SinkRecord record;
@Before
@BeforeEach
public void beforeEach() {
record = new SinkRecord(TOPIC_NAME, PARTITION_NUMBER, Schema.STRING_SCHEMA, "key", Schema.BOOLEAN_SCHEMA, false, KAFKA_OFFSET,
KAFKA_TIMESTAMP, TS_TYPE, null);

View File

@ -25,9 +25,9 @@ import org.apache.kafka.connect.connector.ConnectorTest;
import org.apache.kafka.connect.connector.Task;
import org.apache.kafka.connect.storage.OffsetStorageReader;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class SourceConnectorTest extends ConnectorTest {

View File

@ -21,19 +21,19 @@ import org.apache.kafka.connect.data.Values;
import org.apache.kafka.connect.header.ConnectHeaders;
import org.apache.kafka.connect.header.Header;
import org.apache.kafka.connect.header.Headers;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.Collections;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
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.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class SourceRecordTest {
@ -45,7 +45,7 @@ public class SourceRecordTest {
private SourceRecord record;
@Before
@BeforeEach
public void beforeEach() {
record = new SourceRecord(SOURCE_PARTITION, SOURCE_OFFSET, TOPIC_NAME, PARTITION_NUMBER, Schema.STRING_SCHEMA, "key",
Schema.BOOLEAN_SCHEMA, false, KAFKA_TIMESTAMP, null);

View File

@ -16,9 +16,9 @@
*/
package org.apache.kafka.connect.storage;
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 ConverterTypeTest {

View File

@ -19,18 +19,18 @@ package org.apache.kafka.connect.storage;
import org.apache.kafka.connect.data.Schema;
import org.apache.kafka.connect.data.SchemaAndValue;
import org.apache.kafka.connect.data.SchemaBuilder;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
public class SimpleHeaderConverterTest {
@ -69,7 +69,7 @@ public class SimpleHeaderConverterTest {
private SimpleHeaderConverter converter;
@Before
@BeforeEach
public void beforeEach() {
converter = new SimpleHeaderConverter();
}

View File

@ -18,13 +18,13 @@ package org.apache.kafka.connect.storage;
import org.apache.kafka.connect.data.Schema;
import org.apache.kafka.connect.data.SchemaAndValue;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.UnsupportedEncodingException;
import java.util.Collections;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
public class StringConverterTest {

View File

@ -16,14 +16,14 @@
*/
package org.apache.kafka.connect.util;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class ConnectorUtilsTest {