@Test public void getDataWithPreloadException() throws Exception{ ConcurrentPreloads preloads = new ConcurrentPreloads(); preloads.add(TestFuture.throwsExecutionWrapped()); preloads.add(TestFuture.returnsNormal("foo")); assertEquals(2, preloads.size()); Iterator<PreloadedData> iterator = preloads.iterator(); // First item should throw an exception, a straight PreloadException PreloadedData withError = iterator.next(); try { withError.toJson(); fail(); } catch (PreloadException pe) { assertNull(pe.getCause()); } // And iteration should continue assertEquals(TestFuture.expectedResult("foo"), iterator.next().toJson()); }
@Test public void getDataWithPreloadException() throws Exception{ ConcurrentPreloads preloads = new ConcurrentPreloads(); preloads.add(TestFuture.throwsExecutionWrapped()); preloads.add(TestFuture.returnsNormal("foo")); assertEquals(2, preloads.size()); Iterator<PreloadedData> iterator = preloads.iterator(); // First item should throw an exception, a straight PreloadException PreloadedData withError = iterator.next(); try { withError.toJson(); fail(); } catch (PreloadException pe) { assertNull(pe.getCause()); } // And iteration should continue assertEquals(TestFuture.expectedResult("foo"), iterator.next().toJson()); }
@Test public void getDataWithPreloadException() throws Exception{ ConcurrentPreloads preloads = new ConcurrentPreloads(); preloads.add(TestFuture.throwsExecutionWrapped()); preloads.add(TestFuture.returnsNormal("foo")); assertEquals(2, preloads.size()); Iterator<PreloadedData> iterator = preloads.iterator(); // First item should throw an exception, a straight PreloadException PreloadedData withError = iterator.next(); try { withError.toJson(); fail(); } catch (PreloadException pe) { assertNull(pe.getCause()); } // And iteration should continue assertEquals(TestFuture.expectedResult("foo"), iterator.next().toJson()); }