SequenceHandlingToggle implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(final ContextRefreshedEvent event) { if (configurationAccess.getProperties().getSequenceHandlingUsage() == SequenceHandlingState.ON) { switchOn(); } else { switchOff(); } }  void switchOn(); void switchOff(); boolean isOn(); @Override void onApplicationEvent(final ContextRefreshedEvent event);  }
@Test public void testOnApplicationEventShouldDisableSequenceHandlingWhenConfigPropertyIsOff() { PropertyDto properties = builder.sequenceHandlingState(SequenceHandlingState.OFF).build(); given(configurationAccess.getProperties()).willReturn(properties); underTest.onApplicationEvent(null); verify(sequenceRequestHandlingProcessor).setEnabled(false); }
@Test public void testOnApplicationEventShouldEnableSequenceHandlingWhenConfigPropertyIsOn() { given(configurationAccess.getProperties()).willReturn(builder.sequenceHandlingState(SequenceHandlingState.ON).build()); underTest.onApplicationEvent(null); verify(sequenceRequestHandlingProcessor).setEnabled(true); }