/* * Test Duration#compare(Duration duration) with large durations. * * Bug # 4972785 UnsupportedOperationException is expected * */ @Test(expectedExceptions = UnsupportedOperationException.class) public void checkDurationCompareLarge() { String duration1Lex = "P100000000000000000000D"; String duration2Lex = "PT2400000000000000000000H"; Duration duration1 = datatypeFactory.newDuration(duration1Lex); Duration duration2 = datatypeFactory.newDuration(duration2Lex); duration1.compare(duration2); }
/* * Test for compare() both durations valid and lhs > rhs. */ @Test(dataProvider = "greater-duration") public void checkDurationCompare(String lexRepresentation1, String lexRepresentation2) { Duration duration1 = datatypeFactory.newDuration(lexRepresentation1); Duration duration2 = datatypeFactory.newDuration(lexRepresentation2); assertTrue(duration1.compare(duration2) == DatatypeConstants.GREATER); }