This commit is contained in:
Viktor Klang 2012-01-26 14:15:25 +01:00
parent 87cb83f0d7
commit b310407334
5 changed files with 80 additions and 132 deletions

View file

@ -45,7 +45,7 @@ public class JavaFutureTests {
}
}, system.dispatcher());
Future<String> f2 = f1.map(new Function<String, String>() {
Future<String> f2 = f1.map(new Mapper<String, String>() {
public String apply(String s) {
return s + " World";
}
@ -59,8 +59,8 @@ public class JavaFutureTests {
final CountDownLatch latch = new CountDownLatch(1);
Promise<String> cf = Futures.promise(system.dispatcher());
Future<String> f = cf;
f.onSuccess(new Procedure<String>() {
public void apply(String result) {
f.onSuccess(new OnSuccess<String>() {
public void onSuccess(String result) {
if (result.equals("foo"))
latch.countDown();
}
@ -76,8 +76,8 @@ public class JavaFutureTests {
final CountDownLatch latch = new CountDownLatch(1);
Promise<String> cf = Futures.promise(system.dispatcher());
Future<String> f = cf;
f.onFailure(new Procedure<Throwable>() {
public void apply(Throwable t) {
f.onFailure(new OnFailure() {
public void onFailure(Throwable t) {
if (t instanceof NullPointerException)
latch.countDown();
}
@ -94,8 +94,8 @@ public class JavaFutureTests {
final CountDownLatch latch = new CountDownLatch(1);
Promise<String> cf = Futures.promise(system.dispatcher());
Future<String> f = cf;
f.onComplete(new Procedure2<Throwable,String>() {
public void apply(Throwable t, String r) {
f.onComplete(new OnComplete<String>() {
public void onComplete(Throwable t, String r) {
latch.countDown();
}
});
@ -110,8 +110,8 @@ public class JavaFutureTests {
final CountDownLatch latch = new CountDownLatch(1);
Promise<String> cf = Futures.promise(system.dispatcher());
Future<String> f = cf;
f.foreach(new Procedure<String>() {
public void apply(String future) {
f.foreach(new Foreach<String>() {
public void each(String future) {
latch.countDown();
}
});
@ -127,7 +127,7 @@ public class JavaFutureTests {
Promise<String> cf = Futures.promise(system.dispatcher());
cf.success("1000");
Future<String> f = cf;
Future<Integer> r = f.flatMap(new Function<String, Future<Integer>>() {
Future<Integer> r = f.flatMap(new Mapper<String, Future<Integer>>() {
public Future<Integer> apply(String r) {
latch.countDown();
Promise<Integer> cf = Futures.promise(system.dispatcher());
@ -146,8 +146,8 @@ public class JavaFutureTests {
final CountDownLatch latch = new CountDownLatch(1);
Promise<String> cf = Futures.promise(system.dispatcher());
Future<String> f = cf;
Future<String> r = f.filter(new Function<String, Boolean>() {
public Boolean apply(String r) {
Future<String> r = f.filter(new Filter<String>() {
public boolean filter(String r) {
latch.countDown();
return r.equals("foo");
}