parent
ecdd16363a
commit
9f120b6317
@ -5,6 +5,8 @@ import messagebroker.MessageHandlerContext;
|
|||||||
import messagebroker.UnknownMessageFormatException;
|
import messagebroker.UnknownMessageFormatException;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
public class AddHandlerMessageHandlerTest {
|
public class AddHandlerMessageHandlerTest {
|
||||||
@ -19,6 +21,7 @@ public class AddHandlerMessageHandlerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void shouldHandleMessageWithAddHandlerPattern() throws ReflectiveOperationException, UnknownMessageFormatException {
|
public void shouldHandleMessageWithAddHandlerPattern() throws ReflectiveOperationException, UnknownMessageFormatException {
|
||||||
var handlerName = "AnHandler";
|
var handlerName = "AnHandler";
|
||||||
|
when(context.getOutputStream()).thenReturn(mock(OutputStream.class));
|
||||||
AddHandlerMessageHandler handler = new AddHandlerMessageHandler(context);
|
AddHandlerMessageHandler handler = new AddHandlerMessageHandler(context);
|
||||||
handler.handleMessage("CONTROL.ADD_HANDLER " + handlerName);
|
handler.handleMessage("CONTROL.ADD_HANDLER " + handlerName);
|
||||||
verify(context.getBroker()).addHandler(handlerName);
|
verify(context.getBroker()).addHandler(handlerName);
|
||||||
|
Loading…
Reference in New Issue
Block a user