findepi commented on code in PR #9008: URL: https://github.com/apache/iceberg/pull/9008#discussion_r1629836495
########## api/src/test/java/org/apache/iceberg/transforms/TestTimestamps.java: ########## @@ -241,4 +243,54 @@ public void testTimestampsReturnType() { Type hourResultType = hour.getResultType(type); assertThat(hourResultType).isEqualTo(Types.IntegerType.get()); } + + @Test + public void apply_bad_source_type() { + Timestamps badSourceType = + new Timestamps(ChronoUnit.CENTURIES, Timestamps.ResultTypeUnit.YEARS, "year"); + assertThatThrownBy(() -> badSourceType.apply(11L)) + .isInstanceOf(UnsupportedOperationException.class) + .hasMessageMatching("Unsupported source type unit: Centuries"); + } + + @Test + public void apply_bad_result_type() { Review Comment: @nastra just curious, can this be checked statically, perhaps with a tool like checkstyle? -- 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