@Test public void testHoldTimerTask() throws Exception { HoldTimerTask timerTask = new HoldTimerTask(sxpConnection, 0); when(sxpConnection.getTimestampUpdateOrKeepAliveMessage()).thenReturn(2 * System.currentTimeMillis()); timerTask.call(); verify(sxpConnection).setTimer(TimerType.HoldTimer, timerTask.getPeriod()); when(sxpConnection.isStateOn()).thenReturn(false); timerTask.call(); verify(sxpConnection, times(1)).setTimer(TimerType.HoldTimer, timerTask.getPeriod()); when(sxpConnection.isStateOn()).thenReturn(true); when(sxpConnection.isModeListener()).thenReturn(Boolean.FALSE); timerTask.call(); verify(sxpConnection, times(1)).setTimer(TimerType.HoldTimer, timerTask.getPeriod()); when(sxpConnection.isModeListener()).thenReturn(Boolean.TRUE); when(sxpConnection.isVersion4()).thenReturn(Boolean.FALSE); timerTask.call(); verify(sxpConnection, times(1)).setTimer(TimerType.HoldTimer, timerTask.getPeriod()); when(sxpConnection.isStateOn()).thenReturn(true); when(sxpConnection.isVersion4()).thenReturn(true); when(sxpConnection.getTimestampUpdateOrKeepAliveMessage()).thenReturn(0l); when(sxpConnection.getChannelHandlerContext(any(SxpConnection.ChannelHandlerContextType.class))).thenReturn( mock(ChannelHandlerContext.class)); timerTask.call(); verify(sxpConnection).setDeleteHoldDownTimer(); }
public int getPeriod() { return period; }
SxpTimerTask implements Callable<T> { public int getPeriod() { return period; } }
SxpTimerTask implements Callable<T> { public int getPeriod() { return period; } protected  SxpTimerTask(int period); }
SxpTimerTask implements Callable<T> { public int getPeriod() { return period; } protected  SxpTimerTask(int period); int getPeriod(); }
SxpTimerTask implements Callable<T> { public int getPeriod() { return period; } protected  SxpTimerTask(int period); int getPeriod();  }