Skip to content

Commit 79333f6

Browse files
TheWorkshopComfhussonnois
TheWorkshopCom
authored andcommitted
feat(filters): removing dependency to assertj
1 parent d78219a commit 79333f6

File tree

3 files changed

+17
-29
lines changed

3 files changed

+17
-29
lines changed

connect-file-pulse-plugin/pom.xml

-4
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,6 @@
381381
<groupId>io.rest-assured</groupId>
382382
<artifactId>json-path</artifactId>
383383
</dependency>
384-
<dependency>
385-
<groupId>org.assertj</groupId>
386-
<artifactId>assertj-core</artifactId>
387-
</dependency>
388384
<dependency>
389385
<groupId>io.streamthoughts</groupId>
390386
<artifactId>kafka-connect-filepulse-local-fs</artifactId>

connect-file-pulse-plugin/src/test/java/io/streamthoughts/kafka/connect/filepulse/fs/filter/DateInFilenameFileListFilterTest.java

+17-19
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
import static io.streamthoughts.kafka.connect.filepulse.fs.filter.DateInFilenameFileListFilterTest.Fixture.invalidCutoffDate;
3232
import static io.streamthoughts.kafka.connect.filepulse.fs.filter.DateInFilenameFileListFilterTest.Fixture.maxCutoffDate;
3333
import static io.streamthoughts.kafka.connect.filepulse.fs.filter.DateInFilenameFileListFilterTest.Fixture.minCutoffDate;
34-
import static org.assertj.core.api.Assertions.assertThat;
35-
import static org.assertj.core.api.Assertions.assertThatThrownBy;
34+
import static org.junit.jupiter.api.Assertions.assertEquals;
35+
import static org.junit.jupiter.api.Assertions.assertNull;
36+
import static org.junit.jupiter.api.Assertions.assertThrows;
37+
import static org.junit.jupiter.api.Assertions.assertTrue;
3638
import static org.junit.jupiter.params.provider.Arguments.arguments;
3739

3840
import io.streamthoughts.kafka.connect.filepulse.source.FileObjectMeta;
@@ -52,10 +54,9 @@ class DateInFilenameFileListFilterTest {
5254
@Test
5355
void when_pattern_empty_configure_should_throw_exception() {
5456
DateInFilenameFileListFilter filter = new DateInFilenameFileListFilter();
55-
assertThatThrownBy(() -> filter.configure(Map.of()))
56-
.isInstanceOf(ConfigException.class)
57-
.hasMessageContaining(FILE_FILTER_DATE_REGEX_EXTRACTOR_PATTERN_CONFIG)
58-
.hasNoCause();
57+
ConfigException configException = assertThrows(ConfigException.class, () -> filter.configure(Map.of()));
58+
assertNull(configException.getCause());
59+
assertTrue(configException.getMessage().contains(FILE_FILTER_DATE_REGEX_EXTRACTOR_PATTERN_CONFIG));
5960
}
6061

6162
@Test
@@ -65,10 +66,9 @@ void when_date_min_invalid_configure_should_throw_exception() {
6566
FILE_FILTER_DATE_MIN_DATE_CONFIG, invalidCutoffDate);
6667

6768
DateInFilenameFileListFilter filter = new DateInFilenameFileListFilter();
68-
assertThatThrownBy(() -> filter.configure(configs))
69-
.isInstanceOf(ConfigException.class)
70-
.hasMessageContaining(FILE_FILTER_DATE_MIN_DATE_CONFIG)
71-
.hasNoCause();
69+
ConfigException configException = assertThrows(ConfigException.class, () -> filter.configure(configs));
70+
assertNull(configException.getCause());
71+
assertTrue(configException.getMessage().contains(FILE_FILTER_DATE_MIN_DATE_CONFIG));
7272
}
7373

7474
@Test
@@ -78,10 +78,9 @@ void when_date_max_invalid_configure_should_throw_exception() {
7878
FILE_FILTER_DATE_MAX_DATE_CONFIG, invalidCutoffDate);
7979

8080
DateInFilenameFileListFilter filter = new DateInFilenameFileListFilter();
81-
assertThatThrownBy(() -> filter.configure(configs))
82-
.isInstanceOf(ConfigException.class)
83-
.hasMessageContaining(FILE_FILTER_DATE_MAX_DATE_CONFIG)
84-
.hasNoCause();
81+
ConfigException configException = assertThrows(ConfigException.class, () -> filter.configure(configs));
82+
assertNull(configException.getCause());
83+
assertTrue(configException.getMessage().contains(FILE_FILTER_DATE_MAX_DATE_CONFIG));
8584
}
8685

8786
@Test
@@ -90,10 +89,9 @@ void when_neither_max_date_nor_min_date_provided_configure_should_throw_exceptio
9089
Map.of(FILE_FILTER_DATE_REGEX_EXTRACTOR_PATTERN_CONFIG, dateExtractorRegex);
9190

9291
DateInFilenameFileListFilter filter = new DateInFilenameFileListFilter();
93-
assertThatThrownBy(() -> filter.configure(configs))
94-
.isInstanceOf(ConfigException.class)
95-
.hasMessageContaining("At least one of")
96-
.hasNoCause();
92+
ConfigException configException = assertThrows(ConfigException.class, () -> filter.configure(configs));
93+
assertNull(configException.getCause());
94+
assertTrue(configException.getMessage().contains("At least one of"));
9795
}
9896

9997
private DateInFilenameFileListFilter prepareFilter(String minCutoffDate, String maxCutoffDate) {
@@ -122,7 +120,7 @@ void when_called_test_should_return_expected_value(Boolean expected,
122120
String maxCutoffDate) {
123121

124122
DateInFilenameFileListFilter filter = prepareFilter(minCutoffDate, maxCutoffDate);
125-
assertThat(filter.test(meta)).isEqualTo(expected);
123+
assertEquals(expected, filter.test(meta));
126124
}
127125

128126
public static Stream<Arguments> when_called_test_should_return_expected_value() {

pom.xml

-6
Original file line numberDiff line numberDiff line change
@@ -611,12 +611,6 @@
611611
<version>5.3.0</version>
612612
<scope>test</scope>
613613
</dependency>
614-
<dependency>
615-
<groupId>org.assertj</groupId>
616-
<artifactId>assertj-core</artifactId>
617-
<version>3.24.2</version>
618-
<scope>test</scope>
619-
</dependency>
620614
<!-- END test dependencies-->
621615
</dependencies>
622616
</dependencyManagement>

0 commit comments

Comments
 (0)