public void test_compareTo_nullCorrection() { VersionCorrection a = VersionCorrection.of(INSTANT1, INSTANT2); VersionCorrection b = VersionCorrection.of(INSTANT1, null); assertEquals(true, a.compareTo(a) == 0); assertEquals(true, a.compareTo(b) < 0); assertEquals(true, b.compareTo(a) > 0); assertEquals(true, b.compareTo(b) == 0); }
// ------------------------------------------------------------------------- public void test_compareTo_nonNull() { VersionCorrection a = VersionCorrection.of(INSTANT1, INSTANT2); VersionCorrection b = VersionCorrection.of(INSTANT1, INSTANT3); VersionCorrection c = VersionCorrection.of(INSTANT2, INSTANT3); assertEquals(true, a.compareTo(a) == 0); assertEquals(true, a.compareTo(b) < 0); assertEquals(true, a.compareTo(c) < 0); assertEquals(true, b.compareTo(a) > 0); assertEquals(true, b.compareTo(b) == 0); assertEquals(true, b.compareTo(c) < 0); assertEquals(true, c.compareTo(a) > 0); assertEquals(true, c.compareTo(b) > 0); assertEquals(true, c.compareTo(c) == 0); }
// ------------------------------------------------------------------------- public void test_equals() { VersionCorrection d1a = VersionCorrection.of(INSTANT1, INSTANT2); VersionCorrection d1b = VersionCorrection.of(INSTANT1, INSTANT2); VersionCorrection d2 = VersionCorrection.of(INSTANT1, INSTANT3); assertEquals(true, d1a.equals(d1a)); assertEquals(true, d1a.equals(d1b)); assertEquals(false, d1a.equals(d2)); assertEquals(true, d1b.equals(d1a)); assertEquals(true, d1b.equals(d1b)); assertEquals(false, d1b.equals(d2)); assertEquals(false, d2.equals(d1a)); assertEquals(false, d2.equals(d1b)); assertEquals(true, d2.equals(d2)); assertEquals(false, d1b.equals("d1")); assertEquals(false, d1b.equals(null)); }
// ------------------------------------------------------------------------- public void test_of_InstantInstant() { VersionCorrection test = VersionCorrection.of(INSTANT1, INSTANT2); assertEquals(INSTANT1, test.getVersionAsOf()); assertEquals(INSTANT2, test.getCorrectedTo()); assertEquals("V1970-01-01T00:00:01Z.C1970-01-01T00:00:02Z", test.toString()); }
public void test_of_VersionCorrection_null() { VersionCorrection test = VersionCorrection.of((VersionCorrection) null); assertSame(VersionCorrection.LATEST, test); }
// ------------------------------------------------------------------------- public void test_of_VersionCorrection() { VersionCorrection base = VersionCorrection.of(INSTANT1, INSTANT2); VersionCorrection test = VersionCorrection.of(base); assertSame(base, test); }
public void test_hashCode() { VersionCorrection d1a = VersionCorrection.of(INSTANT1, INSTANT2); VersionCorrection d1b = VersionCorrection.of(INSTANT1, INSTANT2); assertEquals(d1a.hashCode(), d1b.hashCode()); }
public void test_parse_latestCorrection() { VersionCorrection test = VersionCorrection.parse("V1970-01-01T00:00:01Z.CLATEST"); VersionCorrection expected = VersionCorrection.of(INSTANT1, null); assertEquals(expected, test); }
public void test_of_InstantInstant_nulls() { VersionCorrection test = VersionCorrection.of((InstantProvider) null, (InstantProvider) null); assertSame(VersionCorrection.LATEST, test); }
public void test_withLatestFixed_nulls() { VersionCorrection test = VersionCorrection.of(null, null); assertEquals(VersionCorrection.of(INSTANT3, INSTANT3), test.withLatestFixed(INSTANT3)); }
// ------------------------------------------------------------------------- public void test_withLatestFixed_noNulls() { VersionCorrection test = VersionCorrection.of(INSTANT1, INSTANT2); assertSame(test, test.withLatestFixed(INSTANT3)); }
public void test_withCorrectedTo_nullToNull() { VersionCorrection test = VersionCorrection.of(INSTANT1, null); assertEquals(VersionCorrection.of(INSTANT1, null), test.withCorrectedTo(null)); }
public void test_withCorrectedTo_nullToInstant() { VersionCorrection test = VersionCorrection.of(INSTANT1, null); assertEquals(VersionCorrection.of(INSTANT1, INSTANT3), test.withCorrectedTo(INSTANT3)); }
public void test_withVersionAsOf_nullToNull() { VersionCorrection test = VersionCorrection.of(null, INSTANT2); assertEquals(VersionCorrection.of(null, INSTANT2), test.withVersionAsOf(null)); }
// ------------------------------------------------------------------------- public void test_withVersionAsOf_instantToInstant() { VersionCorrection test = VersionCorrection.of(INSTANT1, INSTANT2); assertEquals(VersionCorrection.of(INSTANT3, INSTANT2), test.withVersionAsOf(INSTANT3)); }
public void test_of_InstantInstant_nullVersion() { VersionCorrection test = VersionCorrection.of((InstantProvider) null, INSTANT2); assertEquals(null, test.getVersionAsOf()); assertEquals(INSTANT2, test.getCorrectedTo()); assertEquals("VLATEST.C1970-01-01T00:00:02Z", test.toString()); }
public void test_of_InstantInstant_nullCorrection() { VersionCorrection test = VersionCorrection.of(INSTANT1, (InstantProvider) null); assertEquals(INSTANT1, test.getVersionAsOf()); assertEquals(null, test.getCorrectedTo()); assertEquals("V1970-01-01T00:00:01Z.CLATEST", test.toString()); }
@Test(expectedExceptions = NullPointerException.class) public void test_compareTo_null() { VersionCorrection test = VersionCorrection.of(INSTANT1, INSTANT2); test.compareTo(null); }
// ------------------------------------------------------------------------- public void test_parse() { VersionCorrection test = VersionCorrection.parse("V1970-01-01T00:00:01Z.C1970-01-01T00:00:02Z"); VersionCorrection expected = VersionCorrection.of(INSTANT1, INSTANT2); assertEquals(expected, test); }
public void test_parse_latestVersion() { VersionCorrection test = VersionCorrection.parse("VLATEST.C1970-01-01T00:00:02Z"); VersionCorrection expected = VersionCorrection.of(null, INSTANT2); assertEquals(expected, test); }