### Question:
SolarisConnection { public String executeCommand(String command) { return executeCommand(command, Collections.<String> emptySet(), Collections .<String> emptySet()); } SolarisConnection(SolarisConfiguration config); SolarisConfiguration getConfiguration(); UnixModeDriver getModeDriver(); String sendPassword(GuardedString passwd, Set<String> rejects, Set<String> accepts); void sendPassword(GuardedString passwd); String executeCommand(String command); String executeCommand(String command, int timeout); String executeCommand(String command, Set<String> rejects); String executeCommand(String command, Set<String> rejects, Set<String> accepts); String executeCommand(String command, Map<String, ErrorHandler> rejects,
            Set<String> accepts); void waitForRootShellPrompt(Set<String> rejects); void waitForRootShellPrompt(); void dispose(); String buildCommand(boolean needSudo, String command, CharSequence... arguments); String getRootShellPrompt(); void executeMutexAcquireScript(); void executeMutexAcquireScript(String uidMutexFile, String tmpUidMutexFile,
            String pidFoundFile); void executeMutexReleaseScript(); void executeMutexReleaseScript(String uidMutexFile); void checkAlive(); void doSudoStart(); void doSudoReset(); boolean isNis(); boolean isDefaultNisPwdDir(); boolean isVersionLT10();  }### Answer:
@Test public void testErrorReplyScenario() { Set<String> rejects = new HashSet<String>(); final String error = "ERROR"; rejects.add(error); try { getConnection().executeCommand(String.format("echo \"%s: ahoj ship\"", error), rejects); fail("no exception thrown, when error found."); } catch (ConnectorException e) { } }
@Test(enabled = false) public void testErrorReplyScenarioWithTimeout() { Set<String> rejects = new HashSet<String>(); final String errorMarker = "ERROR"; rejects.add(errorMarker); try { getConnection() .executeCommand( String.format( "timeout=\"%s\" && export timeout && echo \"%s: ahoj\" && sleep \"$timeout\" && echo \"%s\"", TIMEOUT_BETWEEN_MSGS, errorMarker, LAST_ECHOED_INFO), rejects); fail("no exception thrown, when error found."); } catch (ConnectorException e) { final String exMsg = e.getMessage(); Assert.assertTrue(exMsg.contains(LAST_ECHOED_INFO), String.format( "Buffer <%s> doesn't containt the last echoed info: '%s'.", exMsg, LAST_ECHOED_INFO)); } }
@Test public void testSpecialAccepts() { final String ahoj = "AHOJ"; final String errMarker = "ERROR"; getConnection().executeCommand(String.format("echo \"%s\"", ahoj), Collections.<String> emptySet(), CollectionUtil.newSet(ahoj)); try { getConnection().executeCommand(String.format("echo \"%s %s\"", errMarker, ahoj), CollectionUtil.newSet(errMarker), CollectionUtil.newSet(ahoj)); fail("no exception thrown when error should be found in the output."); } catch (ConnectorException ex) { } }