Polishing
This commit is contained in:
@@ -44,7 +44,7 @@ public class ListenableFutureCallbackRegistry<T> {
|
||||
|
||||
|
||||
/**
|
||||
* Adds the given callback to this registry.
|
||||
* Add the given callback to this registry.
|
||||
* @param callback the callback to add
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -67,7 +67,7 @@ public class ListenableFutureCallbackRegistry<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given success callback to this registry.
|
||||
* Add the given success callback to this registry.
|
||||
* @param callback the success callback to add
|
||||
* @since 4.1
|
||||
*/
|
||||
@@ -87,7 +87,7 @@ public class ListenableFutureCallbackRegistry<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given failure callback to this registry.
|
||||
* Add the given failure callback to this registry.
|
||||
* @param callback the failure callback to add
|
||||
* @since 4.1
|
||||
*/
|
||||
@@ -107,8 +107,8 @@ public class ListenableFutureCallbackRegistry<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers a {@link ListenableFutureCallback#onSuccess(Object)} call on all
|
||||
* added callbacks with the given result
|
||||
* Trigger a {@link ListenableFutureCallback#onSuccess(Object)} call on all
|
||||
* added callbacks with the given result.
|
||||
* @param result the result to trigger the callbacks with
|
||||
*/
|
||||
public void success(T result) {
|
||||
@@ -122,7 +122,7 @@ public class ListenableFutureCallbackRegistry<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers a {@link ListenableFutureCallback#onFailure(Throwable)} call on all
|
||||
* Trigger a {@link ListenableFutureCallback#onFailure(Throwable)} call on all
|
||||
* added callbacks with the given {@code Throwable}.
|
||||
* @param ex the exception to trigger the callbacks with
|
||||
*/
|
||||
|
||||
@@ -18,15 +18,11 @@ package org.springframework.util.concurrent;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
@@ -35,7 +31,7 @@ import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
public class ListenableFutureTaskTests {
|
||||
|
||||
@Test
|
||||
public void success() throws ExecutionException, InterruptedException {
|
||||
public void success() throws Exception {
|
||||
final String s = "Hello World";
|
||||
Callable<String> callable = new Callable<String>() {
|
||||
@Override
|
||||
@@ -49,7 +45,6 @@ public class ListenableFutureTaskTests {
|
||||
public void onSuccess(String result) {
|
||||
assertEquals(s, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable ex) {
|
||||
fail(ex.getMessage());
|
||||
@@ -59,7 +54,7 @@ public class ListenableFutureTaskTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void failure() throws ExecutionException, InterruptedException {
|
||||
public void failure() throws Exception {
|
||||
final String s = "Hello World";
|
||||
Callable<String> callable = new Callable<String>() {
|
||||
@Override
|
||||
@@ -73,7 +68,6 @@ public class ListenableFutureTaskTests {
|
||||
public void onSuccess(String result) {
|
||||
fail("onSuccess not expected");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable ex) {
|
||||
assertEquals(s, ex.getMessage());
|
||||
@@ -83,7 +77,7 @@ public class ListenableFutureTaskTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void successWithLambdas() throws ExecutionException, InterruptedException {
|
||||
public void successWithLambdas() throws Exception {
|
||||
final String s = "Hello World";
|
||||
Callable<String> callable = () -> s;
|
||||
SuccessCallback<String> successCallback = mock(SuccessCallback.class);
|
||||
@@ -96,7 +90,7 @@ public class ListenableFutureTaskTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void failureWithLambdas() throws ExecutionException, InterruptedException {
|
||||
public void failureWithLambdas() throws Exception {
|
||||
final String s = "Hello World";
|
||||
IOException ex = new IOException(s);
|
||||
Callable<String> callable = () -> {
|
||||
|
||||
Reference in New Issue
Block a user