@Test public void testSaveToCache() { SSHShellAbstract sshShellAbstract = new SSHShellAbstract() { }; String sessionId = "sessionId"; boolean savedToCache = sshShellAbstract.saveToCache(sshGlobalSessionObjectMock, sshServiceMock, sessionId); assertEquals(false, savedToCache); when(sshServiceMock.saveToCache(sshGlobalSessionObjectMock, sessionId)).thenReturn(true); savedToCache = sshShellAbstract.saveToCache(sshGlobalSessionObjectMock, sshServiceMock, sessionId); assertEquals(true, savedToCache); final GlobalSessionObject<Map<String, SSHConnection>> sessionParam = new GlobalSessionObject<>(); when(sshServiceMock.saveToCache(sessionParam, sessionId)).thenReturn(true); savedToCache = sshShellAbstract.saveToCache(sessionParam, sshServiceMock, sessionId); assertEquals(sessionParam.getName(), "sshSessions:default-id"); assertEquals(true, savedToCache); }
protected boolean saveToCache(GlobalSessionObject<Map<String, SSHConnection>> sessionParam, SSHService service, String sessionId) { if (sessionParam.getName() == null) { sessionParam.setName(Constants.SSH_SESSIONS_DEFAULT_ID); } return service.saveToCache(sessionParam, sessionId); }
SSHShellAbstract { protected boolean saveToCache(GlobalSessionObject<Map<String, SSHConnection>> sessionParam, SSHService service, String sessionId) { if (sessionParam.getName() == null) { sessionParam.setName(Constants.SSH_SESSIONS_DEFAULT_ID); } return service.saveToCache(sessionParam, sessionId); } }
SSHShellAbstract { protected boolean saveToCache(GlobalSessionObject<Map<String, SSHConnection>> sessionParam, SSHService service, String sessionId) { if (sessionParam.getName() == null) { sessionParam.setName(Constants.SSH_SESSIONS_DEFAULT_ID); } return service.saveToCache(sessionParam, sessionId); }  }
SSHShellAbstract { protected boolean saveToCache(GlobalSessionObject<Map<String, SSHConnection>> sessionParam, SSHService service, String sessionId) { if (sessionParam.getName() == null) { sessionParam.setName(Constants.SSH_SESSIONS_DEFAULT_ID); } return service.saveToCache(sessionParam, sessionId); }   }
SSHShellAbstract { protected boolean saveToCache(GlobalSessionObject<Map<String, SSHConnection>> sessionParam, SSHService service, String sessionId) { if (sessionParam.getName() == null) { sessionParam.setName(Constants.SSH_SESSIONS_DEFAULT_ID); } return service.saveToCache(sessionParam, sessionId); }   static final String COMMAND_IS_NOT_SPECIFIED_MESSAGE; }