First stab, do we want to go for throws Throwable or even just switch to RuntimeExceptions?

This commit is contained in:
Viktor Klang 2012-02-16 12:31:49 +01:00
parent 6af612153e
commit e88f2bd936
11 changed files with 45 additions and 38 deletions

View file

@ -150,7 +150,7 @@ public class FaultHandlingTestBase {
}
@Test
public void mustEmploySupervisorStrategy() {
public void mustEmploySupervisorStrategy() throws Exception {
// code here
//#testkit
EventFilter ex1 = (EventFilter) new ErrorFilter(ArithmeticException.class);

View file

@ -130,7 +130,7 @@ public class UntypedActorDocTestBase {
}
@Test
public void usingAsk() {
public void usingAsk() throws Exception {
ActorSystem system = ActorSystem.create("MySystem");
ActorRef myActor = system.actorOf(new Props(new UntypedActorFactory() {
public UntypedActor create() {
@ -188,7 +188,7 @@ public class UntypedActorDocTestBase {
}
@Test
public void useWatch() {
public void useWatch() throws Exception {
ActorSystem system = ActorSystem.create("MySystem");
ActorRef myActor = system.actorOf(new Props(WatchActor.class));
Future<Object> future = Patterns.ask(myActor, "kill", 1000);
@ -197,7 +197,7 @@ public class UntypedActorDocTestBase {
}
@Test
public void usePatternsGracefulStop() {
public void usePatternsGracefulStop() throws Exception {
ActorSystem system = ActorSystem.create("MySystem");
ActorRef actorRef = system.actorOf(new Props(MyUntypedActor.class));
//#gracefulStop

View file

@ -74,7 +74,7 @@ public class FutureDocTestBase {
}
@Test
public void useBlockingFromActor() {
public void useBlockingFromActor() throws Exception {
ActorRef actor = system.actorOf(new Props(MyActor.class));
String msg = "hello";
//#ask-blocking
@ -86,7 +86,7 @@ public class FutureDocTestBase {
}
@Test
public void useFutureEval() {
public void useFutureEval() throws Exception {
//#future-eval
Future<String> f = future(new Callable<String>() {
public String call() {
@ -99,7 +99,7 @@ public class FutureDocTestBase {
}
@Test
public void useMap() {
public void useMap() throws Exception {
//#map
Future<String> f1 = future(new Callable<String>() {
public String call() {
@ -162,7 +162,7 @@ public class FutureDocTestBase {
}
@Test
public void useFlatMap() {
public void useFlatMap() throws Exception {
//#flat-map
Future<String> f1 = future(new Callable<String>() {
public String call() {
@ -186,7 +186,7 @@ public class FutureDocTestBase {
}
@Test
public void useSequence() {
public void useSequence() throws Exception {
List<Future<Integer>> source = new ArrayList<Future<Integer>>();
source.add(Futures.successful(1, system.dispatcher()));
source.add(Futures.successful(2, system.dispatcher()));
@ -214,7 +214,7 @@ public class FutureDocTestBase {
}
@Test
public void useTraverse() {
public void useTraverse() throws Exception {
//#traverse
//Just a sequence of Strings
Iterable<String> listStrings = Arrays.asList("a", "b", "c");
@ -236,7 +236,7 @@ public class FutureDocTestBase {
}
@Test
public void useFold() {
public void useFold() throws Exception {
List<Future<String>> source = new ArrayList<Future<String>>();
source.add(Futures.successful("a", system.dispatcher()));
source.add(Futures.successful("b", system.dispatcher()));
@ -258,7 +258,7 @@ public class FutureDocTestBase {
}
@Test
public void useReduce() {
public void useReduce() throws Exception {
List<Future<String>> source = new ArrayList<Future<String>>();
source.add(Futures.successful("a", system.dispatcher()));
source.add(Futures.successful("b", system.dispatcher()));
@ -280,7 +280,7 @@ public class FutureDocTestBase {
}
@Test
public void useSuccessfulAndFailed() {
public void useSuccessfulAndFailed() throws Exception {
//#successful
Future<String> future = Futures.successful("Yay!", system.dispatcher());
//#successful
@ -294,7 +294,7 @@ public class FutureDocTestBase {
}
@Test
public void useFilter() {
public void useFilter() throws Exception {
//#filter
Future<Integer> future1 = Futures.successful(4, system.dispatcher());
Future<Integer> successfulFilter = future1.filter(new Filter<Integer>() {
@ -338,7 +338,7 @@ public class FutureDocTestBase {
}
@Test
public void useRecover() {
public void useRecover() throws Exception {
//#recover
Future<Integer> future = future(new Callable<Integer>() {
public Integer call() {
@ -358,7 +358,7 @@ public class FutureDocTestBase {
}
@Test
public void useTryRecover() {
public void useTryRecover() throws Exception {
//#try-recover
Future<Integer> future = future(new Callable<Integer>() {
public Integer call() {
@ -382,7 +382,7 @@ public class FutureDocTestBase {
}
@Test
public void useOnSuccessOnFailureAndOnComplete() {
public void useOnSuccessOnFailureAndOnComplete() throws Exception {
{
Future<String> future = Futures.successful("foo", system.dispatcher());
@ -429,7 +429,7 @@ public class FutureDocTestBase {
}
@Test
public void useOrAndZip() {
public void useOrAndZip() throws Exception {
{
//#zip
Future<String> future1 = Futures.successful("foo", system.dispatcher());

View file

@ -55,7 +55,7 @@ public class CustomRouterDocTestBase {
//#crTest
@Test
public void countVotesAsIntendedNotAsInFlorida() {
public void countVotesAsIntendedNotAsInFlorida() throws Exception {
ActorRef routedActor = system.actorOf(new Props().withRouter(new VoteCountRouter()));
routedActor.tell(DemocratVote);
routedActor.tell(DemocratVote);

View file

@ -18,7 +18,7 @@ import akka.dispatch.Await;
//#parentActor
public class ParentActor extends UntypedActor {
public void onReceive(Object msg) {
public void onReceive(Object msg) throws Exception {
if (msg.equals("rrr")) {
//#roundRobinRouter
ActorRef roundRobinRouter = getContext().actorOf(

View file

@ -20,7 +20,7 @@ import static java.util.concurrent.TimeUnit.SECONDS;
public class TransactorDocTest {
@Test
public void coordinatedExample() {
public void coordinatedExample() throws Exception {
//#coordinated-example
ActorSystem system = ActorSystem.create("CoordinatedExample");
@ -63,7 +63,7 @@ public class TransactorDocTest {
}
@Test
public void counterTransactor() {
public void counterTransactor() throws Exception {
ActorSystem system = ActorSystem.create("CounterTransactor");
ActorRef counter = system.actorOf(new Props(Counter.class));
@ -79,7 +79,7 @@ public class TransactorDocTest {
}
@Test
public void friendlyCounterTransactor() {
public void friendlyCounterTransactor() throws Exception {
ActorSystem system = ActorSystem.create("FriendlyCounterTransactor");
ActorRef friend = system.actorOf(new Props(Counter.class));
ActorRef friendlyCounter = system.actorOf(new Props(FriendlyCounter.class));