zentol commented on a change in pull request #18871: URL: https://github.com/apache/flink/pull/18871#discussion_r822553706
########## File path: flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroRecordInputFormatTest.java ########## @@ -199,68 +195,63 @@ public static void writeTestFile(File testFile) throws IOException { dataFileWriter.close(); } - @Before + @BeforeEach public void createFiles() throws IOException { testFile = File.createTempFile("AvroInputFormatTest", null); writeTestFile(testFile); } /** Test if the AvroInputFormat is able to properly read data from an Avro file. */ @Test - public void testDeserialization() throws IOException { + void testDeserialization() throws IOException { Configuration parameters = new Configuration(); AvroInputFormat<User> format = new AvroInputFormat<>(new Path(testFile.getAbsolutePath()), User.class); format.configure(parameters); FileInputSplit[] splits = format.createInputSplits(1); - assertEquals(splits.length, 1); + assertThat(splits.length).isEqualTo(1); format.open(splits[0]); User u = format.nextRecord(null); - assertNotNull(u); + assertThat(u).isNotNull(); String name = u.getName().toString(); - assertNotNull("empty record", name); - assertEquals("name not equal", TEST_NAME, name); + assertThat(name).isNotNull(); + assertThat(name).isEqualTo(TEST_NAME); // check arrays List<CharSequence> sl = u.getTypeArrayString(); - assertEquals("element 0 not equal", TEST_ARRAY_STRING_1, sl.get(0).toString()); - assertEquals("element 1 not equal", TEST_ARRAY_STRING_2, sl.get(1).toString()); + assertThat(sl.get(0).toString()).isEqualTo(TEST_ARRAY_STRING_1); + assertThat(sl.get(1).toString()).isEqualTo(TEST_ARRAY_STRING_2); List<Boolean> bl = u.getTypeArrayBoolean(); - assertEquals("element 0 not equal", TEST_ARRAY_BOOLEAN_1, bl.get(0)); - assertEquals("element 1 not equal", TEST_ARRAY_BOOLEAN_2, bl.get(1)); + assertThat(bl).containsExactly(TEST_ARRAY_BOOLEAN_1, TEST_ARRAY_BOOLEAN_2); // check enums Colors enumValue = u.getTypeEnum(); - assertEquals("enum not equal", TEST_ENUM_COLOR, enumValue); + assertThat(enumValue).isEqualTo(TEST_ENUM_COLOR); // check maps Map<CharSequence, Long> lm = u.getTypeMap(); - assertEquals( - "map value of key 1 not equal", - TEST_MAP_VALUE1, - lm.get(new Utf8(TEST_MAP_KEY1)).longValue()); - assertEquals( - "map value of key 2 not equal", - TEST_MAP_VALUE2, - lm.get(new Utf8(TEST_MAP_KEY2)).longValue()); + assertThat(lm) + .containsEntry(new Utf8(TEST_MAP_KEY1), TEST_MAP_VALUE1) + .containsEntry(new Utf8(TEST_MAP_KEY2), TEST_MAP_VALUE2) + .hasSize(2); Review comment: Well that's gonna be annoying :/ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org