You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/06/03 15:00:06 UTC

[GitHub] [flink] XComp commented on a diff in pull request #19807: [FLINK-27185][connectors] Convert connector-jdbc module to assertj

XComp commented on code in PR #19807:
URL: https://github.com/apache/flink/pull/19807#discussion_r889021351


##########
flink-connectors/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcRowDataLookupFunctionTest.java:
##########
@@ -107,7 +107,7 @@ public void testEvalWithCacheMissingKeyPositive() throws Exception {
         Cache<RowData, List<RowData>> cache = lookupFunction.getCache();
 
         // empty data should cache
-        assertEquals(cache.getIfPresent(keyRow), Collections.<RowData>emptyList());
+        assertThat(Collections.<RowData>emptyList()).isEqualTo(cache.getIfPresent(keyRow));

Review Comment:
   ```suggestion
           assertThat(cache.getIfPresent(keyRow)).isEmpty();
   ```
   That's nitty but wouldn't that be a better approach?



##########
flink-connectors/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcRowDataLookupFunctionTest.java:
##########
@@ -117,7 +117,7 @@ public void testEvalWithCacheMissingKeyPositive() throws Exception {
                         + " (id1, id2, comment1, comment2) VALUES (4, '9', '49-c1', '49-c2')");
 
         lookupFunction.eval(4, StringData.fromString("9"));
-        assertEquals(cache.getIfPresent(keyRow), Collections.<RowData>emptyList());
+        assertThat(Collections.<RowData>emptyList()).isEqualTo(cache.getIfPresent(keyRow));

Review Comment:
   ```suggestion
           assertThat(cache.getIfPresent(keyRow)).isEmpty();
   ```
   nit: Same here...



##########
flink-connectors/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcRowDataLookupFunctionTest.java:
##########
@@ -160,7 +160,7 @@ public void testEvalWithCacheMissingKeyNegative() throws Exception {
                         StringData.fromString("1"),
                         StringData.fromString("51-c1"),
                         StringData.fromString("51-c2")));
-        assertEquals(cache.getIfPresent(keyRow), expectedOutput);
+        assertThat(expectedOutput).isEqualTo(cache.getIfPresent(keyRow));

Review Comment:
   The `assertThat` expects the actual value, not the expected one. Swapping that might lead to confusing output...



-- 
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