From afe820306b1ca8c0a91c21995e60318315193fbf Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Thu, 15 Dec 2011 23:56:37 +0100 Subject: [PATCH] DOC: Minor cleanup by using Futures.successful, which didn't exist a while ago --- .../akka/docs/future/FutureDocTestBase.java | 46 +++---------------- 1 file changed, 7 insertions(+), 39 deletions(-) diff --git a/akka-docs/java/code/akka/docs/future/FutureDocTestBase.java b/akka-docs/java/code/akka/docs/future/FutureDocTestBase.java index af39518184..c185d913f9 100644 --- a/akka-docs/java/code/akka/docs/future/FutureDocTestBase.java +++ b/akka-docs/java/code/akka/docs/future/FutureDocTestBase.java @@ -52,6 +52,7 @@ import akka.actor.UntypedActor; import akka.actor.ActorRef; import akka.docs.actor.MyUntypedActor; import akka.actor.Props; +import akka.dispatch.Futures; import static org.junit.Assert.*; @@ -183,20 +184,9 @@ public class FutureDocTestBase { @Test public void useSequence() { - Future f1 = future(new Callable() { - public Integer call() { - return 1; - } - }, system.dispatcher()); - Future f2 = future(new Callable() { - public Integer call() { - return 2; - } - }, system.dispatcher()); - List> source = new ArrayList>(); - source.add(f1); - source.add(f2); + source.add(Futures.successful(1, system.dispatcher())); + source.add(Futures.successful(2, system.dispatcher())); //#sequence //Some source generating a sequence of Future:s @@ -244,20 +234,9 @@ public class FutureDocTestBase { @Test public void useFold() { - Future f1 = future(new Callable() { - public String call() { - return "a"; - } - }, system.dispatcher()); - Future f2 = future(new Callable() { - public String call() { - return "b"; - } - }, system.dispatcher()); - List> source = new ArrayList>(); - source.add(f1); - source.add(f2); + source.add(Futures.successful("a", system.dispatcher())); + source.add(Futures.successful("b", system.dispatcher())); //#fold //A sequence of Futures, in this case Strings @@ -277,20 +256,9 @@ public class FutureDocTestBase { @Test public void useReduce() { - Future f1 = future(new Callable() { - public String call() { - return "a"; - } - }, system.dispatcher()); - Future f2 = future(new Callable() { - public String call() { - return "b"; - } - }, system.dispatcher()); - List> source = new ArrayList>(); - source.add(f1); - source.add(f2); + source.add(Futures.successful("a", system.dispatcher())); + source.add(Futures.successful("b", system.dispatcher())); //#reduce //A sequence of Futures, in this case Strings