You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "RocMarshal (via GitHub)" <gi...@apache.org> on 2024/04/12 00:22:26 UTC
Re: [PR] [FLINK-29050][JUnit5 Migration] Module: flink-hadoop-compatibility [flink]
RocMarshal commented on code in PR #20990:
URL: https://github.com/apache/flink/pull/20990#discussion_r1296008112
##########
flink-connectors/flink-hadoop-compatibility/src/test/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopInputFormatTest.java:
##########
@@ -137,27 +132,26 @@ public void testFetchNextRecordReaderHasNewValue() throws Exception {
setupHadoopInputFormat(new DummyInputFormat(), Job.getInstance(), recordReader);
hadoopInputFormat.fetchNext();
- assertThat(hadoopInputFormat.fetched, is(true));
- assertThat(hadoopInputFormat.hasNext, is(true));
+ assertThat(hadoopInputFormat.fetched).isTrue();
+ assertThat(hadoopInputFormat.hasNext).isTrue();
}
@Test
- public void testFetchNextRecordReaderThrowsException() throws Exception {
+ void testFetchNextRecordReaderThrowsException() throws Exception {
DummyRecordReader recordReader = mock(DummyRecordReader.class);
when(recordReader.nextKeyValue()).thenThrow(new InterruptedException());
HadoopInputFormat<String, Long> hadoopInputFormat =
setupHadoopInputFormat(new DummyInputFormat(), Job.getInstance(), recordReader);
- exception.expect(IOException.class);
- hadoopInputFormat.fetchNext();
+ assertThatThrownBy(hadoopInputFormat::fetchNext).isInstanceOf(IOException.class);
- assertThat(hadoopInputFormat.hasNext, is(true));
+ assertThat(hadoopInputFormat.hasNext).isFalse();
Review Comment:
Hi, @1996fanrui nice catch.
sorry for no explaining this change before the review.
When debugging the line, it was caused by `Expect exception mechanism` difference between junit4 and junit5. to be short, in junit4, the target line `assertThat(hadoopInputFormat.hasNext, is(true));` was not executed.
So the change occurred to here.
--
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-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org