diff options
author | Magdalena GrodziĆska <mag.grodzinska@gmail.com> | 2019-12-23 19:19:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-23 19:19:30 +0100 |
commit | 0949c9d56c595c0e253e6a35604fb2b9af46f82a (patch) | |
tree | 7f573d76b1c89c1165513d90ecd82694e849e4da /src/test/java/pl/edu/mimuw/cloudatlas/agent/ExecutorTest.java | |
parent | 651c2b76ff3db39cefd1542d6f4c19d8686dfb85 (diff) | |
parent | 7a104ca7eeb0d312bc76d2393495387079032aed (diff) |
Merge pull request #67 from m-chrzan/event_bus
Event bus
Diffstat (limited to 'src/test/java/pl/edu/mimuw/cloudatlas/agent/ExecutorTest.java')
-rw-r--r-- | src/test/java/pl/edu/mimuw/cloudatlas/agent/ExecutorTest.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/ExecutorTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/ExecutorTest.java index 445a5b4..2a6ef49 100644 --- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/ExecutorTest.java +++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/ExecutorTest.java @@ -9,6 +9,11 @@ import pl.edu.mimuw.cloudatlas.agent.message.AgentMessage.AgentModule; public class ExecutorTest { public class MessageCounterModule extends Module { public int counter = 0; + + MessageCounterModule(AgentModule moduleType) { + super(moduleType); + } + public void handle(AgentMessage m) { counter++; } @@ -16,7 +21,7 @@ public class ExecutorTest { @Test public void testDoesntExecuteWhenNoMessages() throws Exception { - MessageCounterModule module = new MessageCounterModule(); + MessageCounterModule module = new MessageCounterModule(AgentModule.UDP); Executor executor = new Executor(module); Thread thread = new Thread(executor); thread.start(); @@ -27,7 +32,7 @@ public class ExecutorTest { @Test public void testExecutesHandlerOnce() throws Exception { - MessageCounterModule module = new MessageCounterModule(); + MessageCounterModule module = new MessageCounterModule(AgentModule.UDP); Executor executor = new Executor(module); executor.addMessage(new AgentMessage("", AgentModule.UDP, 0) {}); Thread thread = new Thread(executor); @@ -39,7 +44,7 @@ public class ExecutorTest { @Test public void testExecutesHandlerMultipleTimes() throws Exception { - MessageCounterModule module = new MessageCounterModule(); + MessageCounterModule module = new MessageCounterModule(AgentModule.UDP); Executor executor = new Executor(module); executor.addMessage(new AgentMessage("", AgentModule.UDP, 0) {}); executor.addMessage(new AgentMessage("", AgentModule.UDP, 0) {}); |