@Test public void testRun() throws Exception { Class<ConditionMonitor> class1 = ConditionMonitor.class; Field field = class1.getDeclaredField("conditionSegments"); field.setAccessible(true); ConditionSegment conditionSegment = mock(ConditionSegment.class); ConditionParameterName conditionParameterName = mock(ConditionParameterName.class); conditionMonitor.run(); System.out.println(field.get(conditionMonitor)); conditionSegments.add(conditionSegment); field.set(conditionMonitor, conditionSegments); when(conditionSegment.getPrecursorRelationOperator()).thenReturn(ConditionSegment.PrecursorRelationOperator.Not); when(conditionSegment.getConditionParameterName()).thenReturn(conditionParameterName); when(conditionParameterName.getValue()).thenReturn(new String("test")); conditionMonitor.run(); System.out.println(field.get(conditionMonitor)); }
@Override public void run() { boolean currentState = ConditionDeterminer.isConditionMet(conditionSegments); if (currentState != preState) { try { intentResolver.resolveIntent(userId); } catch (Exception e) { log.error("Exception:",e); } preState = currentState; } }
ConditionMonitor extends TimerTask { @Override public void run() { boolean currentState = ConditionDeterminer.isConditionMet(conditionSegments); if (currentState != preState) { try { intentResolver.resolveIntent(userId); } catch (Exception e) { log.error("Exception:",e); } preState = currentState; } } }
ConditionMonitor extends TimerTask { @Override public void run() { boolean currentState = ConditionDeterminer.isConditionMet(conditionSegments); if (currentState != preState) { try { intentResolver.resolveIntent(userId); } catch (Exception e) { log.error("Exception:",e); } preState = currentState; } } ConditionMonitor(IntentResolver intentResolver, UserId userId, List<ConditionSegment> conditionSegments); }
ConditionMonitor extends TimerTask { @Override public void run() { boolean currentState = ConditionDeterminer.isConditionMet(conditionSegments); if (currentState != preState) { try { intentResolver.resolveIntent(userId); } catch (Exception e) { log.error("Exception:",e); } preState = currentState; } } ConditionMonitor(IntentResolver intentResolver, UserId userId, List<ConditionSegment> conditionSegments); @Override void run(); }
ConditionMonitor extends TimerTask { @Override public void run() { boolean currentState = ConditionDeterminer.isConditionMet(conditionSegments); if (currentState != preState) { try { intentResolver.resolveIntent(userId); } catch (Exception e) { log.error("Exception:",e); } preState = currentState; } } ConditionMonitor(IntentResolver intentResolver, UserId userId, List<ConditionSegment> conditionSegments); @Override void run();  }