slinkydeveloper commented on a change in pull request #19039:
URL: https://github.com/apache/flink/pull/19039#discussion_r825999098
##########
File path:
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/stream/sql/DataStreamJavaITCase.java
##########
@@ -864,28 +861,28 @@ private void createTableFromElements(
}
private static void testSchema(Table table, Column... expectedColumns) {
- assertEquals(ResolvedSchema.of(expectedColumns),
table.getResolvedSchema());
+
assertThat(table.getResolvedSchema()).isEqualTo(ResolvedSchema.of(expectedColumns));
}
private static void testSchema(Table table, ResolvedSchema expectedSchema)
{
- assertEquals(expectedSchema, table.getResolvedSchema());
+ assertThat(table.getResolvedSchema()).isEqualTo(expectedSchema);
}
private static void testSchema(TableResult result, Column...
expectedColumns) {
- assertEquals(ResolvedSchema.of(expectedColumns),
result.getResolvedSchema());
+
assertThat(result.getResolvedSchema()).isEqualTo(ResolvedSchema.of(expectedColumns));
}
private static void testResult(TableResult result, Row... expectedRows) {
final List<Row> actualRows =
CollectionUtil.iteratorToList(result.collect());
- assertThat(actualRows, containsInAnyOrder(expectedRows));
+
assertThat(actualRows).satisfies(matching(containsInAnyOrder(expectedRows)));
}
@SafeVarargs
private static <T> void testResult(DataStream<T> dataStream, T...
expectedResult)
throws Exception {
try (CloseableIterator<T> iterator = dataStream.executeAndCollect()) {
final List<T> list = CollectionUtil.iteratorToList(iterator);
- assertThat(list, containsInAnyOrder(expectedResult));
+
assertThat(list).satisfies(matching(containsInAnyOrder(expectedResult)));
Review comment:
> Is the type relevant for us (e.g., some cases where the migration
wouldn't work), or is this just a limitation of the tool?
It is in the sense that the tool can come up with an invalid migration when
you're using a matcher within another matcher. For example:
```
assertThat(list, containsInAnyOrder(someOtherMatcherForItem1,
someOtherMatcherForItem2));
```
I tried to use type inference here to check whether you're using matchers or
not, but it fails most of the times and comes up with invalid migrations...
For this PR I'll manually fix the occurrences, for next ones i'll see if we can
come up with another solution.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]