4141import java .util .Map ;
4242import java .util .UUID ;
4343
44- import static org .junit . jupiter .api .Assertions .assertDoesNotThrow ;
44+ import static org .assertj . core .api .Assertions .assertThatNoException ;
4545
4646/** Tests for {@link HudiMetadataApplier}. */
4747class HudiMetadataApplierTest {
@@ -86,28 +86,32 @@ void testApplySchemaChange() throws Exception {
8686 "col3DefValue" )));
8787 AddColumnEvent addColumnEvent =
8888 new AddColumnEvent (TableId .parse ("test.table1" ), addedColumns );
89- assertDoesNotThrow (() -> metadataApplier .applySchemaChange (addColumnEvent ));
89+ assertThatNoException ()
90+ .isThrownBy (() -> metadataApplier .applySchemaChange (addColumnEvent ));
9091
9192 // Test rename column
9293 Map <String , String > nameMapping = new HashMap <>();
9394 nameMapping .put ("col2" , "newcol2" );
9495 nameMapping .put ("col3" , "newcol3" );
9596 RenameColumnEvent renameColumnEvent =
9697 new RenameColumnEvent (TableId .parse ("test.table1" ), nameMapping );
97- assertDoesNotThrow (() -> metadataApplier .applySchemaChange (renameColumnEvent ));
98+ assertThatNoException ()
99+ .isThrownBy (() -> metadataApplier .applySchemaChange (renameColumnEvent ));
98100
99101 // Test alter column type
100102 Map <String , DataType > typeMapping = new HashMap <>();
101103 typeMapping .put ("newcol2" , org .apache .flink .cdc .common .types .DataTypes .STRING ());
102104 AlterColumnTypeEvent alterColumnTypeEvent =
103105 new AlterColumnTypeEvent (TableId .parse ("test.table1" ), typeMapping );
104- assertDoesNotThrow (() -> metadataApplier .applySchemaChange (alterColumnTypeEvent ));
106+ assertThatNoException ()
107+ .isThrownBy (() -> metadataApplier .applySchemaChange (alterColumnTypeEvent ));
105108
106109 // Test drop column
107110 DropColumnEvent dropColumnEvent =
108111 new DropColumnEvent (
109112 TableId .parse ("test.table1" ), Collections .singletonList ("newcol2" ));
110- assertDoesNotThrow (() -> metadataApplier .applySchemaChange (dropColumnEvent ));
113+ assertThatNoException ()
114+ .isThrownBy (() -> metadataApplier .applySchemaChange (dropColumnEvent ));
111115 }
112116 }
113117
@@ -182,7 +186,8 @@ void testCreateTableWithAllDataTypes() throws Exception {
182186 org .apache .flink .cdc .common .types .DataTypes .TIMESTAMP ())
183187 .primaryKey ("col1" )
184188 .build ());
185- assertDoesNotThrow (() -> metadataApplier .applySchemaChange (createTableEvent ));
189+ assertThatNoException ()
190+ .isThrownBy (() -> metadataApplier .applySchemaChange (createTableEvent ));
186191 }
187192 }
188193
@@ -197,6 +202,6 @@ void testClose() throws Exception {
197202 config .set (HudiConfig .TABLE_TYPE , "MERGE_ON_READ" );
198203
199204 HudiMetadataApplier metadataApplier = new HudiMetadataApplier (config );
200- assertDoesNotThrow (metadataApplier ::close );
205+ assertThatNoException (). isThrownBy (metadataApplier ::close );
201206 }
202207}
0 commit comments