Skip to content

Commit 04182f5

Browse files
Merge pull request #14 from aiven/ivanyu-hashfield-no-param-test
Remove unnecessary parametrization from HashTest
2 parents 6aaa720 + e4a2bca commit 04182f5

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/test/java/io/aiven/kafka/connect/transforms/HashTest.java

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,20 @@ void noFieldName_NullValue_Skip() {
6363
assertEquals(originalRecord, result);
6464
}
6565

66-
@ParameterizedTest
67-
@ValueSource(strings = {"md5", "sha1", "sha256"})
68-
void nullSchema(final String hashFunction) {
66+
@Test
67+
void nullSchema() {
6968
final SinkRecord originalRecord = record(null, null);
7069
final Throwable e = assertThrows(DataException.class,
71-
() -> transformation(FIELD, true, hashFunction).apply(originalRecord));
70+
() -> transformation(FIELD, true, DEFAULT_HASH_FUNCTION).apply(originalRecord));
7271
assertEquals(dataPlace() + " schema can't be null: " + originalRecord, e.getMessage());
7372
}
7473

75-
@ParameterizedTest
76-
@ValueSource(strings = {"md5", "sha1", "sha256"})
77-
void noFieldName_UnsupportedType(final String hashFunction) {
74+
@Test
75+
void noFieldName_UnsupportedType() {
7876
final Schema schema = SchemaBuilder.struct().build();
7977
final SinkRecord originalRecord = record(schema, new Struct(schema));
8078
final Throwable e = assertThrows(DataException.class,
81-
() -> transformation(null, true, hashFunction).apply(originalRecord));
79+
() -> transformation(null, true, DEFAULT_HASH_FUNCTION).apply(originalRecord));
8280
assertEquals(dataPlace()
8381
+ " schema type must be STRING if field name is not specified: "
8482
+ originalRecord,
@@ -153,41 +151,38 @@ void fieldName_MissingValue_Skip() {
153151
assertEquals(originalRecord, result);
154152
}
155153

156-
@ParameterizedTest
157-
@ValueSource(strings = {"md5", "sha1", "sha256"})
158-
void fieldName_NonStruct(final String hashFunction) {
154+
@Test
155+
void fieldName_NonStruct() {
159156
final SinkRecord originalRecord = record(SchemaBuilder.INT8_SCHEMA, "some");
160157
final Throwable e = assertThrows(DataException.class,
161-
() -> transformation(FIELD, true, hashFunction).apply(originalRecord));
158+
() -> transformation(FIELD, true, DEFAULT_HASH_FUNCTION).apply(originalRecord));
162159
assertEquals(dataPlace() + " schema type must be STRUCT if field name is specified: "
163160
+ originalRecord,
164161
e.getMessage());
165162
}
166163

167-
@ParameterizedTest
168-
@ValueSource(strings = {"md5", "sha1", "sha256"})
169-
void fieldName_NullStruct(final String hashFunction) {
164+
@Test
165+
void fieldName_NullStruct() {
170166
final Schema schema = SchemaBuilder.struct()
171167
.field(FIELD, SchemaBuilder.STRING_SCHEMA)
172168
.schema();
173169
final SinkRecord originalRecord = record(schema, null);
174170
final Throwable e = assertThrows(DataException.class,
175-
() -> transformation(FIELD, true, hashFunction).apply(originalRecord));
171+
() -> transformation(FIELD, true, DEFAULT_HASH_FUNCTION).apply(originalRecord));
176172
assertEquals(dataPlace() + " can't be null if field name is specified: " + originalRecord,
177173
e.getMessage());
178174
}
179175

180-
@ParameterizedTest
181-
@ValueSource(strings = {"md5", "sha1", "sha256"})
182-
void fieldName_UnsupportedTypeInField(final String hashFunction) {
176+
@Test
177+
void fieldName_UnsupportedTypeInField() {
183178
final Schema innerSchema = SchemaBuilder.struct().build();
184179
final Schema schema = SchemaBuilder.struct()
185180
.field(FIELD, innerSchema)
186181
.schema();
187182
final SinkRecord originalRecord = record(
188183
schema, new Struct(schema).put(FIELD, new Struct(innerSchema)));
189184
final Throwable e = assertThrows(DataException.class,
190-
() -> transformation(FIELD, true, hashFunction).apply(originalRecord));
185+
() -> transformation(FIELD, true, DEFAULT_HASH_FUNCTION).apply(originalRecord));
191186
assertEquals(FIELD + " schema type in " + dataPlace() + " must be STRING: "
192187
+ originalRecord,
193188
e.getMessage());

0 commit comments

Comments
 (0)