Skip to content

Commit

Permalink
Auxiliary tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Morten Haraldsen committed Jan 31, 2024
1 parent 891e648 commit f0a2992
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/test/java/com/ethlo/time/DateTimeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class DateTimeTest
final DateTime a = ITU.parseLenient("2018-01-06T23:59:12-04:30");
final DateTime b = ITU.parseLenient("2018-01-06T23:59:12-04:30");
final DateTime c = ITU.parseLenient("2018-01-06T23:59:12-05:30");
final DateTime d = DateTime.of(2000, 12, 10, 12, 22, 18, TimezoneOffset.UTC);
final DateTime e = DateTime.ofDate(2000, 12, 10);

@Test
public void testEquals()
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/com/ethlo/time/FormatterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ void testFormatUtc()
assertThat(actual).isEqualTo(expected);
}

@Test
void testFormatHour()
{
assertThat(DateTime.of(2000, 12, 31, 22, 30, null).toString(Field.HOUR)).isEqualTo("2000-12-31T22");
}

@Test
void testFormatUtcMilli()
{
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/com/ethlo/time/ParseConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,16 @@ void setAllowTrailingJunk()
{
assertThat(ParseConfig.DEFAULT.withFailOnTrailingJunk(true).isFailOnTrailingJunk()).isTrue();
}

@Test
void checkAllowedDateTimeSeparators()
{
assertThat(ParseConfig.STRICT.getDateTimeSeparators()).containsExactly('T');
}

@Test
void checkAllowedFractionsSeparators()
{
assertThat(ParseConfig.STRICT.getFractionSeparators()).containsExactly('.');
}
}

0 comments on commit f0a2992

Please sign in to comment.