From 4456b71ab46b375eb21861051423222e6e5bb01e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Mon, 23 Dec 2019 19:08:44 +0100 Subject: Adjust executor tests to module changes --- src/test/java/pl/edu/mimuw/cloudatlas/agent/ExecutorTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/test/java/pl/edu/mimuw/cloudatlas') 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) {}); -- cgit v1.2.3