Content-Length: 270101 | pFad | http://github.com/apache/iceberg/commit/76cdc626067ce333f36dd67f04243c9ce2730cc1

B0 More concrete error message test · apache/iceberg@76cdc62 · GitHub
Skip to content

Commit

Permalink
More concrete error message test
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Vary committed Apr 24, 2024
1 parent 9b906aa commit 76cdc62
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void testIncrementalFromSnapshotId() {
.streaming(true)
.startingStrategy(StreamingStartingStrategy.INCREMENTAL_FROM_SNAPSHOT_ID)
.build())
.hasMessageContaining("Invalid starting snapshot id for")
.hasMessage("Invalid starting snapshot id for SPECIFIC_START_SNAPSHOT_ID strategy: null")
.isInstanceOf(IllegalArgumentException.class);

Assertions.assertThatThrownBy(
Expand All @@ -41,7 +41,7 @@ void testIncrementalFromSnapshotId() {
.startSnapshotId(1L)
.startSnapshotTimestamp(1L)
.build())
.hasMessageContaining("Invalid starting snapshot timestamp for")
.hasMessage("Invalid starting snapshot timestamp for SPECIFIC_START_SNAPSHOT_ID strategy: not null")
.isInstanceOf(IllegalArgumentException.class);
}

Expand All @@ -53,7 +53,7 @@ void testIncrementalFromSnapshotTimestamp() {
.streaming(true)
.startingStrategy(StreamingStartingStrategy.INCREMENTAL_FROM_SNAPSHOT_TIMESTAMP)
.build())
.hasMessageContaining("Invalid starting snapshot timestamp for")
.hasMessage("Invalid starting snapshot timestamp for SPECIFIC_START_SNAPSHOT_TIMESTAMP strategy: null")
.isInstanceOf(IllegalArgumentException.class);

Assertions.assertThatThrownBy(
Expand All @@ -64,58 +64,57 @@ void testIncrementalFromSnapshotTimestamp() {
.startSnapshotId(1L)
.startSnapshotTimestamp(1L)
.build())
.hasMessageContaining("Invalid starting snapshot id for")
.hasMessage("Invalid starting snapshot id for SPECIFIC_START_SNAPSHOT_ID strategy: not null")
.isInstanceOf(IllegalArgumentException.class);
}

@Test
void testStreaming() {
Assertions.assertThatThrownBy(() -> ScanContext.builder().streaming(true).useTag("tag").build())
.hasMessageContaining("Cannot scan table using ref")
.hasMessageContaining("for streaming reader")
.hasMessage("Cannot scan table using ref tag configured for streaming reader")
.isInstanceOf(IllegalArgumentException.class);

Assertions.assertThatThrownBy(
() -> ScanContext.builder().streaming(true).useSnapshotId(1L).build())
.hasMessageContaining("Cannot set snapshot-id option for streaming reader")
.hasMessage("Cannot set snapshot-id option for streaming reader")
.isInstanceOf(IllegalArgumentException.class);

Assertions.assertThatThrownBy(
() -> ScanContext.builder().streaming(true).asOfTimestamp(1L).build())
.hasMessageContaining("Cannot set as-of-timestamp option for streaming reader")
.hasMessage("Cannot set as-of-timestamp option for streaming reader")
.isInstanceOf(IllegalArgumentException.class);

Assertions.assertThatThrownBy(
() -> ScanContext.builder().streaming(true).endSnapshotId(1L).build())
.hasMessageContaining("Cannot set end-snapshot-id option for streaming reader")
.hasMessage("Cannot set end-snapshot-id option for streaming reader")
.isInstanceOf(IllegalArgumentException.class);

Assertions.assertThatThrownBy(() -> ScanContext.builder().streaming(true).endTag("tag").build())
.hasMessageContaining("Cannot set end-tag option for streaming reader")
.hasMessage("Cannot set end-tag option for streaming reader")
.isInstanceOf(IllegalArgumentException.class);
}

@Test
void testStartConflict() {
Assertions.assertThatThrownBy(
() -> ScanContext.builder().startTag("tag").startSnapshotId(1L).build())
.hasMessageContaining("START_SNAPSHOT_ID and START_TAG cannot both be set.")
.hasMessage("START_SNAPSHOT_ID and START_TAG cannot both be set.")
.isInstanceOf(IllegalArgumentException.class);
}

@Test
void testEndConflict() {
Assertions.assertThatThrownBy(
() -> ScanContext.builder().endTag("tag").endSnapshotId(1L).build())
.hasMessageContaining("END_SNAPSHOT_ID and END_TAG cannot both be set.")
.hasMessage("END_SNAPSHOT_ID and END_TAG cannot both be set.")
.isInstanceOf(IllegalArgumentException.class);
}

@Test
void testMaxAllowedPlanningFailures() {
Assertions.assertThatThrownBy(
() -> ScanContext.builder().maxAllowedPlanningFailures(-2).build())
.hasMessageContaining("annot set maxAllowedPlanningFailures to a negative number")
.hasMessage("Cannot set maxAllowedPlanningFailures to a negative number other than -1.")
.isInstanceOf(IllegalArgumentException.class);
}
}

0 comments on commit 76cdc62

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/apache/iceberg/commit/76cdc626067ce333f36dd67f04243c9ce2730cc1

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy