@Test public void testNotifySuccess() { assertFalse(result.completed()); BatchResult.Callback<Boolean, StorageException> callback = EasyMock.createStrictMock(BatchResult.Callback.class); callback.success(true); EasyMock.replay(callback); result.notify(callback); result.success(true); try { result.notify(callback); fail("The batch has been completed."); } catch (IllegalStateException exception) { // expected } EasyMock.verify(callback); } }
@Test public void testNotifySuccess() { assertFalse(result.completed()); BatchResult.Callback<Boolean, DnsException> callback = EasyMock.createStrictMock(BatchResult.Callback.class); callback.success(true); EasyMock.replay(callback); result.notify(callback); result.success(true); try { result.notify(callback); fail("The batch has been completed."); } catch (IllegalStateException exception) { // expected } EasyMock.verify(callback); } }
@Test public void testNotifySuccess() { assertFalse(result.completed()); BatchResult.Callback<Boolean, BaseServiceException> callback = EasyMock.createStrictMock(BatchResult.Callback.class); callback.success(true); EasyMock.replay(callback); result.notify(callback); result.success(true); try { result.notify(callback); fail("The batch has been completed."); } catch (IllegalStateException exception) { // expected } EasyMock.verify(callback); } }
/** Sets a result and status as completed. Notifies all callbacks. */ protected void success(T result) { this.result = result; this.completed = true; for (Callback<T, E> callback : toBeNotified) { callback.success(result); } }
/** * Sets a result and status as completed. Notifies all callbacks. */ protected void success(T result) { this.result = result; this.completed = true; for (Callback<T, E> callback : toBeNotified) { callback.success(result); } }
/** Sets a result and status as completed. Notifies all callbacks. */ protected void success(T result) { this.result = result; this.completed = true; for (Callback<T, E> callback : toBeNotified) { callback.success(result); } }