Skip to content

Commit

Permalink
Fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
takezoe committed Nov 22, 2024
1 parent b857465 commit 0733431
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,61 +156,61 @@ public void testLiterals()

// Invalid qualifiers (DAY TO xxx)
assertThatThrownBy(assertions.expression("INTERVAL '12' DAY TO DAY")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: DAY to DAY");
.hasMessage("line 1:12: Invalid interval qualifier: DAY TO DAY");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' DAY TO YEAR")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: DAY to YEAR");
.hasMessage("line 1:12: Invalid interval qualifier: DAY TO YEAR");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' DAY TO MONTH")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: DAY to MONTH");
.hasMessage("line 1:12: Invalid interval qualifier: DAY TO MONTH");

// Invalid qualifiers (HOUR TO xxx)
assertThatThrownBy(assertions.expression("INTERVAL '10' HOUR TO HOUR")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: HOUR to HOUR");
.hasMessage("line 1:12: Invalid interval qualifier: HOUR TO HOUR");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' HOUR TO YEAR")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: HOUR to YEAR");
.hasMessage("line 1:12: Invalid interval qualifier: HOUR TO YEAR");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' HOUR TO MONTH")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: HOUR to MONTH");
.hasMessage("line 1:12: Invalid interval qualifier: HOUR TO MONTH");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' HOUR TO DAY")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: HOUR to DAY");
.hasMessage("line 1:12: Invalid interval qualifier: HOUR TO DAY");

// Invalid qualifiers (MINUTE TO xxx)
assertThatThrownBy(assertions.expression("INTERVAL '45' MINUTE TO MINUTE")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: MINUTE to MINUTE");
.hasMessage("line 1:12: Invalid interval qualifier: MINUTE TO MINUTE");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' MINUTE TO YEAR")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: MINUTE to YEAR");
.hasMessage("line 1:12: Invalid interval qualifier: MINUTE TO YEAR");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' MINUTE TO MONTH")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: MINUTE to MONTH");
.hasMessage("line 1:12: Invalid interval qualifier: MINUTE TO MONTH");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' MINUTE TO DAY")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: MINUTE to DAY");
.hasMessage("line 1:12: Invalid interval qualifier: MINUTE TO DAY");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' MINUTE TO HOUR")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: MINUTE to HOUR");
.hasMessage("line 1:12: Invalid interval qualifier: MINUTE TO HOUR");

// Invalid qualifiers (SECOND TO xxx)
assertThatThrownBy(assertions.expression("INTERVAL '32' SECOND TO SECOND")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: SECOND to SECOND");
.hasMessage("line 1:12: Invalid interval qualifier: SECOND TO SECOND");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' SECOND TO YEAR")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: SECOND to YEAR");
.hasMessage("line 1:12: Invalid interval qualifier: SECOND TO YEAR");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' SECOND TO MONTH")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: SECOND to MONTH");
.hasMessage("line 1:12: Invalid interval qualifier: SECOND TO MONTH");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' SECOND TO DAY")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: SECOND to DAY");
.hasMessage("line 1:12: Invalid interval qualifier: SECOND TO DAY");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' SECOND TO HOUR")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: SECOND to HOUR");
.hasMessage("line 1:12: Invalid interval qualifier: SECOND TO HOUR");

assertThatThrownBy(assertions.expression("INTERVAL '12-10' SECOND TO MINUTE")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: SECOND to MINUTE");
.hasMessage("line 1:12: Invalid interval qualifier: SECOND TO MINUTE");
}

private static SqlIntervalDayTime interval(int day, int hour, int minute, int second, int milliseconds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,38 +84,38 @@ public void testLiterals()

// Invalid qualifiers (YEAR TO xxx)
assertThatThrownBy(assertions.expression("INTERVAL '32767' YEAR TO YEAR")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: YEAR to YEAR");
.hasMessage("line 1:12: Invalid interval qualifier: YEAR TO YEAR");

assertThatThrownBy(assertions.expression("INTERVAL '124-30' YEAR TO DAY")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: YEAR to DAY");
.hasMessage("line 1:12: Invalid interval qualifier: YEAR TO DAY");

assertThatThrownBy(assertions.expression("INTERVAL '124-30' YEAR TO HOUR")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: YEAR to HOUR");
.hasMessage("line 1:12: Invalid interval qualifier: YEAR TO HOUR");

assertThatThrownBy(assertions.expression("INTERVAL '124-30' YEAR TO MINUTE")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: YEAR to MINUTE");
.hasMessage("line 1:12: Invalid interval qualifier: YEAR TO MINUTE");

assertThatThrownBy(assertions.expression("INTERVAL '124-30' YEAR TO SECOND")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: YEAR to SECOND");
.hasMessage("line 1:12: Invalid interval qualifier: YEAR TO SECOND");

// Invalid qualifiers (MONTH TO xxx)
assertThatThrownBy(assertions.expression("INTERVAL '30' MONTH TO MONTH")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: MONTH to MONTH");
.hasMessage("line 1:12: Invalid interval qualifier: MONTH TO MONTH");

assertThatThrownBy(assertions.expression("INTERVAL '124-30' MONTH TO YEAR")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: MONTH to YEAR");
.hasMessage("line 1:12: Invalid interval qualifier: MONTH TO YEAR");

assertThatThrownBy(assertions.expression("INTERVAL '124-30' MONTH TO DAY")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: MONTH to DAY");
.hasMessage("line 1:12: Invalid interval qualifier: MONTH TO DAY");

assertThatThrownBy(assertions.expression("INTERVAL '124-30' MONTH TO HOUR")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: MONTH to HOUR");
.hasMessage("line 1:12: Invalid interval qualifier: MONTH TO HOUR");

assertThatThrownBy(assertions.expression("INTERVAL '124-30' MONTH TO MINUTE")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: MONTH to MINUTE");
.hasMessage("line 1:12: Invalid interval qualifier: MONTH TO MINUTE");

assertThatThrownBy(assertions.expression("INTERVAL '124-30' MONTH TO SECOND")::evaluate)
.hasMessage("line 1:12: Invalid interval qualifier: MONTH to SECOND");
.hasMessage("line 1:12: Invalid interval qualifier: MONTH TO SECOND");
}

private static SqlIntervalYearMonth interval(int year, int month)
Expand Down

0 comments on commit 0733431

Please sign in to comment.