@Test public void canBeActivatedAndDeactivated() { DeferredExecutionActionProxy proxy = new DeferredExecutionActionProxy(mock(FormAction.class)); assertTrue(proxy.isActivated()); proxy.setActivated(false); assertFalse(proxy.isActivated()); proxy.setActivated(true); assertTrue(proxy.isActivated()); }
@Test public void shouldSkipProxiedActionIfDeactivated() { FormAction actionMock = mock(FormAction.class); DeferredExecutionActionProxy proxy = new DeferredExecutionActionProxy(actionMock); assertTrue(proxy.isActivated()); proxy.setActivated(false); proxy.execute(); verify(actionMock, times(0)).execute(); }