@Test
public void waitUntilCommandFinishesTest() {

    Mockito.when(sshSession.getExitStatus()).thenReturn(null, null, new Integer(1));
    Mockito.doNothing().when(threadUtils).sleepThread(Mockito.anyInt());
    spy.waitUntilCommandFinishes("hostIp", "command", sshSession);
    Mockito.verify(sshSession, Mockito.times(3)).getExitStatus();
    Mockito.verify(threadUtils, Mockito.times(2)).sleepThread(Mockito.eq(5));
}