@Test public void shouldDelegateToProxiedActionIfActivated() { FormAction actionMock = mock(FormAction.class); DeferredExecutionActionProxy proxy = new DeferredExecutionActionProxy(actionMock); assertTrue(proxy.isActivated()); proxy.execute(); verify(actionMock).execute(); }
@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(); }
@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 shouldBeActivatedByDefault() { DeferredExecutionActionProxy proxy = new DeferredExecutionActionProxy(mock(FormAction.class)); assertTrue(proxy.isActivated()); }