public void testRegisteredCommand() { final UnknownCommand cmd = new UnknownCommand("1", CONTENT); final VoidResponse testResponse = new VoidResponse(cmd, "A", "B"); final Function<UnknownCommand, GwResponse> specialHandler = new Function<UnknownCommand, GwResponse>() { public GwResponse apply(UnknownCommand from) { assertSame(cmd, from); return testResponse; } }; handler.registerSubhandler(UnknownCommand.class, specialHandler); assertSame(testResponse, handler.apply(cmd)); }
public void testUnsupportedCommand() { VoidResponse response = (VoidResponse) handler.apply(new AdminCommand("1", CONTENT)); assertEquals("unsupported_1", response.suggestLogFilename()); }
public void testUnknownCommand() { VoidResponse response = (VoidResponse) handler.apply(new UnknownCommand("1", CONTENT)); assertEquals("unknown_1", response.suggestLogFilename()); }