DOC: Minor cleanup by using Futures.successful, which didn't exist a while ago

This commit is contained in:
Patrik Nordwall 2011-12-15 23:56:37 +01:00
parent 38ff479a39
commit afe820306b

View file

@ -52,6 +52,7 @@ import akka.actor.UntypedActor;
import akka.actor.ActorRef; import akka.actor.ActorRef;
import akka.docs.actor.MyUntypedActor; import akka.docs.actor.MyUntypedActor;
import akka.actor.Props; import akka.actor.Props;
import akka.dispatch.Futures;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -183,20 +184,9 @@ public class FutureDocTestBase {
@Test @Test
public void useSequence() { public void useSequence() {
Future<Integer> f1 = future(new Callable<Integer>() {
public Integer call() {
return 1;
}
}, system.dispatcher());
Future<Integer> f2 = future(new Callable<Integer>() {
public Integer call() {
return 2;
}
}, system.dispatcher());
List<Future<Integer>> source = new ArrayList<Future<Integer>>(); List<Future<Integer>> source = new ArrayList<Future<Integer>>();
source.add(f1); source.add(Futures.successful(1, system.dispatcher()));
source.add(f2); source.add(Futures.successful(2, system.dispatcher()));
//#sequence //#sequence
//Some source generating a sequence of Future<Integer>:s //Some source generating a sequence of Future<Integer>:s
@ -244,20 +234,9 @@ public class FutureDocTestBase {
@Test @Test
public void useFold() { public void useFold() {
Future<String> f1 = future(new Callable<String>() {
public String call() {
return "a";
}
}, system.dispatcher());
Future<String> f2 = future(new Callable<String>() {
public String call() {
return "b";
}
}, system.dispatcher());
List<Future<String>> source = new ArrayList<Future<String>>(); List<Future<String>> source = new ArrayList<Future<String>>();
source.add(f1); source.add(Futures.successful("a", system.dispatcher()));
source.add(f2); source.add(Futures.successful("b", system.dispatcher()));
//#fold //#fold
//A sequence of Futures, in this case Strings //A sequence of Futures, in this case Strings
@ -277,20 +256,9 @@ public class FutureDocTestBase {
@Test @Test
public void useReduce() { public void useReduce() {
Future<String> f1 = future(new Callable<String>() {
public String call() {
return "a";
}
}, system.dispatcher());
Future<String> f2 = future(new Callable<String>() {
public String call() {
return "b";
}
}, system.dispatcher());
List<Future<String>> source = new ArrayList<Future<String>>(); List<Future<String>> source = new ArrayList<Future<String>>();
source.add(f1); source.add(Futures.successful("a", system.dispatcher()));
source.add(f2); source.add(Futures.successful("b", system.dispatcher()));
//#reduce //#reduce
//A sequence of Futures, in this case Strings //A sequence of Futures, in this case Strings