コード例 #1
0
  @Test
  public void shouldDelegateToProxiedActionIfActivated() {
    FormAction actionMock = mock(FormAction.class);
    DeferredExecutionActionProxy proxy = new DeferredExecutionActionProxy(actionMock);
    assertTrue(proxy.isActivated());

    proxy.execute();

    verify(actionMock).execute();
  }
コード例 #2
0
  @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();
  }
コード例 #3
0
  @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());
  }
コード例 #4
0
  @Test
  public void shouldBeActivatedByDefault() {
    DeferredExecutionActionProxy proxy = new DeferredExecutionActionProxy(mock(FormAction.class));

    assertTrue(proxy.isActivated());
  }