KeyController implements ViewConstants { @RequestMapping(method = { RequestMethod.POST }, value = "/sendKey") @ResponseBody public void sendKey(HttpServletRequest req, HttpServletResponse resp, @RequestParam(value="deviceIds[]") String[] deviceIds, @RequestParam String key, @RequestParam(required = false) String remoteType) throws KeyException, InterruptedException { sendKey(req, resp, deviceIds, key, null, remoteType); }  @RequestMapping(method = { RequestMethod.POST }, value = "/sendKey") @ResponseBody void sendKey(HttpServletRequest req, HttpServletResponse resp,
            @RequestParam(value="deviceIds[]") String[] deviceIds, @RequestParam String key, @RequestParam(required = false) String remoteType); @RequestMapping(method = {RequestMethod.POST }, value = "/holdKey") @ResponseBody void holdKey(HttpServletRequest req, HttpServletResponse resp, 
            @RequestParam(value="deviceIds[]") String[] deviceIds, @RequestParam String key, @RequestParam String holdTime, @RequestParam(required = false) String remoteType); @RequestMapping(method = { RequestMethod.POST }, value = "/directtune") @ResponseBody void directTune(HttpServletRequest req, HttpServletResponse resp,
            @RequestParam(value = "deviceIds[]") String[] deviceIds,
            @RequestParam String channelNum,
            @RequestParam(required = false) String remoteType);  }
@Test(dataProvider = "testSendKeyData") public void testSendKey(String[] deviceIds, String key, String remoteType) throws KeyException, InterruptedException { final MockMetaStbCache cache = new MockMetaStbCache(); MetaStb stb = TestUtils.createGenericMetaStb(); cache.cache.put(TestUtils.ID, stb); final IrClient client = EasyMock.createMock(IrClient.class); client.pressKeys(Key.GUIDE); EasyMock.expectLastCall(); HttpServletRequest req = createReq(); EasyMock.replay(client, req); KeyController controller = new KeyController(); Assert.notNull(controller.createSendKeyThread(null, null, null, null, null, null)); RemotePluginManager rpm = new RemotePluginManager(); controller = getKeyController(cache, client, rpm); Wiring.autowire(controller, cache); Wiring.autowire(controller, rpm); controller.sendKey(req, null, deviceIds, key, remoteType); EasyMock.verify(client, req); }