Exemplo n.º 1
0
  // #crTest
  @Test
  public void countVotesAsIntendedNotAsInFlorida() {
    ActorRef routedActor = system.actorOf(new Props().withRouter(new VoteCountRouter()));
    routedActor.tell(DemocratVote);
    routedActor.tell(DemocratVote);
    routedActor.tell(RepublicanVote);
    routedActor.tell(DemocratVote);
    routedActor.tell(RepublicanVote);
    Timeout timeout = new Timeout(Duration.parse("1 seconds"));
    Future<Object> democratsResult = routedActor.ask(DemocratCountResult, timeout);
    Future<Object> republicansResult = routedActor.ask(RepublicanCountResult, timeout);

    assertEquals(3, Await.result(democratsResult, timeout.duration()));
    assertEquals(2, Await.result(republicansResult, timeout.duration()));
  }
Exemplo n.º 2
0
 @After
 public void tearDown() {
   system.shutdown();
 }
Exemplo n.º 3
0
 @Before
 public void setUp() {
   system = ActorSystem.create("MySystem", AkkaSpec.testConf());
 }