nastra commented on code in PR #9782:
URL: https://github.com/apache/iceberg/pull/9782#discussion_r1566941616


##########
core/src/test/java/org/apache/iceberg/rest/responses/TestListNamespacesResponse.java:
##########
@@ -83,9 +83,32 @@ public void testBuilderDoesNotCreateInvalidObjects() {
         .hasMessage("Invalid namespace: null");
   }
 
+  @Test
+  public void testWithNullPaginationToken() throws JsonProcessingException {
+    String jsonWithNullPageToken =
+        
"{\"namespaces\":[[\"accounting\"],[\"tax\"]],\"next-page-token\":null}";
+    ListNamespacesResponse response =
+        
ListNamespacesResponse.builder().addAll(NAMESPACES).nextPageToken(null).build();
+    assertRoundTripSerializesEquallyFrom(jsonWithNullPageToken, response);
+    Assertions.assertThat(response.nextPageToken()).isNull();
+    Assertions.assertThat(response.namespaces()).isEqualTo(NAMESPACES);
+  }
+
+  @Test
+  public void testWithPaginationToken() throws JsonProcessingException {
+    String pageToken = "token";
+    String jsonWithPageToken =
+        
"{\"namespaces\":[[\"accounting\"],[\"tax\"]],\"next-page-token\":\"token\"}";
+    ListNamespacesResponse response =
+        
ListNamespacesResponse.builder().addAll(NAMESPACES).nextPageToken(pageToken).build();
+    assertRoundTripSerializesEquallyFrom(jsonWithPageToken, response);
+    Assertions.assertThat(response.nextPageToken()).isNotNull();

Review Comment:
   ```suggestion
       Assertions.assertThat(response.nextPageToken()).isEqualTo("token");
   ```



-- 
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...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to