nastra commented on code in PR #3650:
URL: https://github.com/apache/parquet-java/pull/3650#discussion_r3548970806


##########
parquet-thrift/src/test/java/org/apache/parquet/thrift/projection/TestStrictFieldProjectionFilter.java:
##########
@@ -18,97 +18,73 @@
  */
 package org.apache.parquet.thrift.projection;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 
 import java.util.Arrays;
-import java.util.List;
 import org.junit.Test;
 
 public class TestStrictFieldProjectionFilter {
 
   @Test
   public void testFromSemicolonDelimitedString() {
-    List<String> globs = 
StrictFieldProjectionFilter.parseSemicolonDelimitedString(";x.y.z;*.a.b.c*;;foo;;;;bar;");
-    assertEquals(Arrays.asList("x.y.z", "*.a.b.c*", "foo", "bar"), globs);
+    
assertThat(StrictFieldProjectionFilter.parseSemicolonDelimitedString(";x.y.z;*.a.b.c*;;foo;;;;bar;"))
+        .containsExactly("x.y.z", "*.a.b.c*", "foo", "bar");
 
-    try {
-      StrictFieldProjectionFilter.parseSemicolonDelimitedString(";;");
-      fail("this should throw");
-    } catch (ThriftProjectionException e) {
-      assertEquals("Semicolon delimited string ';;' contains 0 glob strings", 
e.getMessage());
-    }
-  }
-
-  private static void assertMatches(StrictFieldProjectionFilter filter, 
String... strings) {
-    for (String s : strings) {
-      if (!filter.keep(s)) {
-        fail(String.format("String '%s' was expected to match", s));
-      }
-    }
-  }
-
-  private static void assertDoesNotMatch(StrictFieldProjectionFilter filter, 
String... strings) {
-    for (String s : strings) {
-      if (filter.keep(s)) {
-        fail(String.format("String '%s' was not expected to match", s));
-      }
-    }
+    assertThatThrownBy(() -> 
StrictFieldProjectionFilter.parseSemicolonDelimitedString(";;"))
+        .isInstanceOf(ThriftProjectionException.class)
+        .hasMessage("Semicolon delimited string ';;' contains 0 glob strings");
   }
 
   @Test
   public void testProjection() {
     StrictFieldProjectionFilter filter = 
StrictFieldProjectionFilter.fromSemicolonDelimitedString(
         
"home.phone_number;home.address;work.address.zip;base_info;*.average;a.b.c.pre{x,y,z{a,b,c}}post");
 
-    assertMatches(
-        filter,
-        "home.phone_number",
-        "home.address",
-        "work.address.zip",
-        "base_info",
-        "foo.average",
-        "bar.x.y.z.average",
-        "base_info.nested.field",
-        "a.b.c.prexpost",
-        "a.b.c.prezapost");
+    assertThat(filter.keep("home.phone_number")).isTrue();

Review Comment:
   this way it's easier to spot which of the pattern is the cause if the test 
ever fails



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to