if (exception.isEmpty()) { canon.add(exception); } else {
@Test public void testCanonicalExceptions() { List<RVVException> exceptionList = new ArrayList<>(); for (int i = NUM_TEST_EXCEPTIONS; i > 0; --i) { long start = i * TEST_EXCEPTION_SIZE; long end = start + TEST_EXCEPTION_SIZE; RVVException testException = RVVException.createException(start, end); for (long j = start + 2; j < end; j += 2) { testException.add(j); } exceptionList.add(testException); } List<RVVException> canonicalExceptions = RegionVersionHolder.canonicalExceptions(exceptionList); long expectedStart = NUM_TEST_EXCEPTIONS * TEST_EXCEPTION_SIZE + TEST_EXCEPTION_SIZE - 2; for (RVVException exception : canonicalExceptions) { assertEquals(expectedStart, exception.previousVersion); assertEquals(expectedStart + 2, exception.nextVersion); assertTrue(exception.isEmpty()); expectedStart -= 2; } }