Skip to content

Commit

Permalink
Reorder asserts in getBoolOrNull Test
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellSpitzer committed Jan 24, 2025
1 parent 6fac1a4 commit 61f18c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/src/test/java/org/apache/iceberg/util/TestJsonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ public void getBool() throws JsonProcessingException {

@Test
public void getBoolOrNull() throws JsonProcessingException {
assertThat(JsonUtil.getBoolOrNull("x", JsonUtil.mapper().readTree("{}"))).isNull();

assertThat(JsonUtil.getBoolOrNull("x", JsonUtil.mapper().readTree("{\"x\": null}"))).isNull();

assertThatThrownBy(
() -> JsonUtil.getBoolOrNull("x", JsonUtil.mapper().readTree("{\"x\": \"23\"}")))
.isInstanceOf(IllegalArgumentException.class)
Expand All @@ -211,6 +207,10 @@ public void getBoolOrNull() throws JsonProcessingException {
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Cannot parse to a boolean value: x: \"true\"");

assertThat(JsonUtil.getBoolOrNull("x", JsonUtil.mapper().readTree("{}"))).isNull();

assertThat(JsonUtil.getBoolOrNull("x", JsonUtil.mapper().readTree("{\"x\": null}"))).isNull();

assertThat(JsonUtil.getBoolOrNull("x", JsonUtil.mapper().readTree("{\"x\": true}"))).isTrue();
assertThat(JsonUtil.getBoolOrNull("x", JsonUtil.mapper().readTree("{\"x\": false}"))).isFalse();
}
Expand Down

0 comments on commit 61f18c2

Please sign in to comment.