コード例 #1
0
  public void testHiddenWhenOncePersistedAnnotationPickedUpOn() {
    class Customer {
      @Hidden(when = When.ONCE_PERSISTED)
      public void someAction() {}
    }
    final Method actionMethod = findMethod(Customer.class, "someAction");

    facetFactory.process(
        new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));

    final Facet facet = facetedMethod.getFacet(HiddenFacet.class);
    final HiddenFacetAbstract hiddenFacetAbstract = (HiddenFacetAbstract) facet;

    assertEquals(When.ONCE_PERSISTED, hiddenFacetAbstract.when());
  }
コード例 #2
0
  public void testHiddenAnnotationPickedUpOnAction() {
    class Customer {
      @Hidden
      public void someAction() {}
    }
    final Method actionMethod = findMethod(Customer.class, "someAction");

    facetFactory.process(
        new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));

    final Facet facet = facetedMethod.getFacet(HiddenFacet.class);
    assertNotNull(facet);
    assertTrue(facet instanceof HiddenFacetAbstract);

    assertNoMethodsRemoved();
  }
コード例 #3
0
  public void testHiddenWhenAndWhereTableAnnotationPickedUpOn() {
    class Customer {
      @Hidden(where = Where.PARENTED_TABLES, when = When.UNTIL_PERSISTED)
      public void someAction() {}
    }
    final Method actionMethod = findMethod(Customer.class, "someAction");

    facetFactory.process(
        new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));

    final Facet facet = facetedMethod.getFacet(HiddenFacet.class);
    final HiddenFacetAbstract hiddenFacetAbstract = (HiddenFacetAbstract) facet;

    assertEquals(Where.PARENTED_TABLES, hiddenFacetAbstract.where());
    assertEquals(When.UNTIL_PERSISTED, hiddenFacetAbstract.when());
  }
コード例 #4
0
  public void testHiddenAnnotationPickedUpOnProperty() {
    class Customer {
      @Hidden
      public int getNumberOfOrders() {
        return 0;
      }
    }
    final Method actionMethod = findMethod(Customer.class, "getNumberOfOrders");

    facetFactory.process(
        new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));

    final Facet facet = facetedMethod.getFacet(HiddenFacet.class);
    assertNotNull(facet);
    assertTrue(facet instanceof HiddenFacetAbstract);

    assertNoMethodsRemoved();
  }