/** * Tests the {@link PersistingCmrProcessor}. */ @Test public void persistingCmrProcessor() { // only Timer Data PersistingCmrProcessor processor = new PersistingCmrProcessor(Collections.<Class<? extends DefaultData>> singletonList(TimerData.class)); // don't fail on null processor.process((DefaultData) null, entityManager); verifyZeroInteractions(entityManager); // don't process wrong classes processor.process(new SqlStatementData(), entityManager); processor.process(new HttpTimerData(), entityManager); verifyZeroInteractions(entityManager); // yes for correct class TimerData timerData = new TimerData(); processor.process(timerData, entityManager); verify(entityManager, times(1)).persist(timerData); // no when influx is active processor.influxActive = true; processor.process(timerData, entityManager); verifyNoMoreInteractions(entityManager); }