// ----------------------------------------------------------------------- public void test_setInstant() { for (int i = -1100; i < 1100; i++) { Instant instant = Instant.ofEpochMilli(i); GregorianCalendar test = new GregorianCalendar(); test.setInstant(instant); assertEquals(test.getTimeInMillis(), i); } }
public void test_setInstant_badProvider() { GregorianCalendar test = new GregorianCalendar(); try { test.setInstant(new MockInstantProviderReturnsNull()); fail(); } catch (NullPointerException ex) { // expected } }
public void test_setInstant_tooSmall() { GregorianCalendar test = new GregorianCalendar(); try { test.setInstant(Instant.ofEpochSecond(Long.MIN_VALUE / 1000 - 1)); fail(); } catch (CalendricalException ex) { // expected } }
public void test_setInstant_null() { GregorianCalendar test = new GregorianCalendar(); try { test.setInstant((Instant) null); fail(); } catch (NullPointerException ex) { // expected } }