use of org.joda.time.TimeOfDay in project joda-time by JodaOrg.
the class TestGJChronology method testTimeOfDayAdd.
public void testTimeOfDayAdd() {
TimeOfDay start = new TimeOfDay(12, 30, GJChronology.getInstance());
TimeOfDay end = new TimeOfDay(10, 30, GJChronology.getInstance());
assertEquals(end, start.plusHours(22));
assertEquals(start, end.minusHours(22));
assertEquals(end, start.plusMinutes(22 * 60));
assertEquals(start, end.minusMinutes(22 * 60));
}
use of org.joda.time.TimeOfDay in project joda-time by JodaOrg.
the class TestISOChronology method testTimeOfDayAdd.
public void testTimeOfDayAdd() {
TimeOfDay start = new TimeOfDay(12, 30);
TimeOfDay end = new TimeOfDay(10, 30);
assertEquals(end, start.plusHours(22));
assertEquals(start, end.minusHours(22));
assertEquals(end, start.plusMinutes(22 * 60));
assertEquals(start, end.minusMinutes(22 * 60));
}
use of org.joda.time.TimeOfDay in project joda-time by JodaOrg.
the class TestDateConverter method testGetPartialValues.
//-----------------------------------------------------------------------
public void testGetPartialValues() throws Exception {
TimeOfDay tod = new TimeOfDay();
int[] expected = COPTIC.get(tod, 12345678L);
int[] actual = DateConverter.INSTANCE.getPartialValues(tod, new Date(12345678L), COPTIC);
assertEquals(true, Arrays.equals(expected, actual));
}
use of org.joda.time.TimeOfDay in project joda-time by JodaOrg.
the class TestOffsetDateTimeField method test_set_RP_int_intarray_int.
public void test_set_RP_int_intarray_int() {
OffsetDateTimeField field = new MockOffsetDateTimeField();
int[] values = new int[] { 10, 20, 30, 40 };
int[] expected = new int[] { 10, 20, 30, 40 };
int[] result = field.set(new TimeOfDay(), 2, values, 30);
assertEquals(true, Arrays.equals(result, expected));
values = new int[] { 10, 20, 30, 40 };
expected = new int[] { 10, 20, 29, 40 };
result = field.set(new TimeOfDay(), 2, values, 29);
assertEquals(true, Arrays.equals(result, expected));
values = new int[] { 10, 20, 30, 40 };
expected = new int[] { 10, 20, 30, 40 };
try {
field.set(new TimeOfDay(), 2, values, 63);
fail();
} catch (IllegalArgumentException ex) {
}
assertEquals(true, Arrays.equals(values, expected));
values = new int[] { 10, 20, 30, 40 };
expected = new int[] { 10, 20, 30, 40 };
try {
field.set(new TimeOfDay(), 2, values, 2);
fail();
} catch (IllegalArgumentException ex) {
}
assertEquals(true, Arrays.equals(values, expected));
}
use of org.joda.time.TimeOfDay in project joda-time by JodaOrg.
the class TestOffsetDateTimeField method test_set_RP_int_intarray_String_Locale.
public void test_set_RP_int_intarray_String_Locale() {
OffsetDateTimeField field = new MockOffsetDateTimeField();
int[] values = new int[] { 10, 20, 30, 40 };
int[] expected = new int[] { 10, 20, 30, 40 };
int[] result = field.set(new TimeOfDay(), 2, values, "30", null);
assertEquals(true, Arrays.equals(result, expected));
values = new int[] { 10, 20, 30, 40 };
expected = new int[] { 10, 20, 29, 40 };
result = field.set(new TimeOfDay(), 2, values, "29", Locale.ENGLISH);
assertEquals(true, Arrays.equals(result, expected));
values = new int[] { 10, 20, 30, 40 };
expected = new int[] { 10, 20, 30, 40 };
try {
field.set(new TimeOfDay(), 2, values, "63", null);
fail();
} catch (IllegalArgumentException ex) {
}
assertEquals(true, Arrays.equals(values, expected));
values = new int[] { 10, 20, 30, 40 };
expected = new int[] { 10, 20, 30, 40 };
try {
field.set(new TimeOfDay(), 2, values, "2", null);
fail();
} catch (IllegalArgumentException ex) {
}
assertEquals(true, Arrays.equals(values, expected));
}
Aggregations