@Test public void testCanStopTheSeleneseSessionEvenIfThereIsNoCurrentSession() { final HttpCommandProcessor processor; processor = new HttpCommandProcessor("a Server", 1234, "", "a url"); processor.stop(); }
@Test public void testCanStopTheSeleneseSessionWhenASessionIsInProgress() { final HttpCommandProcessor processor; processor = new HttpCommandProcessor("a Server", 1234, "", "a url") { @Override public String doCommand(String commandName, String[] args) { assertEquals("testComplete", commandName); assertNull(args); return null; } }; processor.setSessionInProgress("123456789"); processor.stop(); }
@Test public void testGetBooleanArray() throws Exception { HttpCommandProcessor processor = new HttpCommandProcessor("localhost", 4444, "*chrome", "http://www.openqa.org"); processor = spy(processor); String[] cmdArgs = new String[] {"1", "2"}; String[] cmdResults = new String[] {"true", "false"}; boolean[] boolCmdResults = new boolean[] {true, false}; doReturn(cmdResults).when(processor).getStringArray("command", cmdArgs); boolean[] methodResults = processor.getBooleanArray("command", cmdArgs); assertEquals(boolCmdResults[0], methodResults[0]); assertEquals(boolCmdResults[1], methodResults[1]); }
@Override protected void closeResources(HttpURLConnection conn, Writer wr, Reader rdr) { closedConn = conn; closedWriter = wr; closedReader = rdr; super.closeResources(conn, wr, rdr); }