diff --git a/src/test/java/io/aiven/kafka/connect/transforms/FilterByFieldValueTest.java b/src/test/java/io/aiven/kafka/connect/transforms/FilterByFieldValueTest.java index a83fe03..2070e16 100644 --- a/src/test/java/io/aiven/kafka/connect/transforms/FilterByFieldValueTest.java +++ b/src/test/java/io/aiven/kafka/connect/transforms/FilterByFieldValueTest.java @@ -138,6 +138,24 @@ void shouldFilterOutKeyRecordsNotEqualsToId() { .isEqualTo(record); } + @Test + void shouldFilterOutRecordNotEqualsToIntId() { + final FilterByFieldValue filter = new FilterByFieldValue.Value<>(); + filter.configure(Map.of( + "field.name", "EventId", + "field.value", "4690", + "field.value.matches", "true" + )); + + assertThat(filter.apply(prepareRecord(() -> "A42", () -> Map.of("EventId", 4663)))) + .as("Record with id not equal to 'A132' should be filtered out") + .isNull(); + final SourceRecord record = prepareRecord(() -> "A42", () -> Map.of("EventId", 4690)); + assertThat(filter.apply(record)) + .as("Record with id equal to '4690' should not be filtered out") + .isEqualTo(record); + } + @Test void shouldFilterOutMapValueRecordsWithRegex() { final FilterByFieldValue filterByFieldValue = new FilterByFieldValue.Value<>(); @@ -147,7 +165,9 @@ void shouldFilterOutMapValueRecordsWithRegex() { configs.put("field.value.matches", "false"); filterByFieldValue.configure(configs); - assertThat(filterByFieldValue.apply(prepareRecord(() -> "A42", () -> Map.of("language", "Javascript")))) + assertThat(filterByFieldValue.apply( + prepareRecord(() -> "A42", () -> Map.of("language", "Javascript")) + )) .as("The record should be filtered out") .isNull(); final SourceRecord record = prepareRecord(() -> "A42", () -> Map.of("language", "Rust"));