final Facet facet0 = facetHolderWithParms.getFacet(ActionInvocationFacet.class);
assertNotNull(facet0);
}
public void testActionsPickedUpFromSuperclassButHelpersFromSubClass() {
ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
facetFactory.setSpecificationLookup(reflector);
reflector.setLoadSpecificationStringReturn(voidSpec);
ActionParameterChoicesFacetFactory facetFactoryForChoices = new ActionParameterChoicesFacetFactory();
facetFactoryForChoices.setSpecificationLookup(reflector);
reflector.setLoadSpecificationStringReturn(voidSpec);
DisabledFacetViaDisableMethodFacetFactory facetFactoryForDisable = new DisabledFacetViaDisableMethodFacetFactory();
facetFactoryForDisable.setSpecificationLookup(reflector);
reflector.setLoadSpecificationStringReturn(voidSpec);
class Customer {
@SuppressWarnings("unused")
public void someAction(final int x, final long y) {}
@SuppressWarnings("unused")
public int[] choices0SomeAction() {
return new int[0];
}
}
class CustomerEx extends Customer {
@Override
public int[] choices0SomeAction() {
return new int[0];
}
@SuppressWarnings("unused")
public long[] choices1SomeAction() {
return new long[0];
}
@SuppressWarnings("unused")
public String disableSomeAction() {
return null;
}
}
Method actionMethod = findMethod(CustomerEx.class, "someAction", new Class[] { int.class, long.class });
Method choices0Method = findMethod(CustomerEx.class, "choices0SomeAction", new Class[] {});
Method choices1Method = findMethod(CustomerEx.class, "choices1SomeAction", new Class[] {});
Method disableMethod = findMethod(CustomerEx.class, "disableSomeAction", new Class[] {});
FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(CustomerEx.class, actionMethod);
final ProcessMethodContext processMethodContext = new ProcessMethodContext(CustomerEx.class, actionMethod, methodRemover, facetHolderWithParms);
facetFactory.process(processMethodContext);
facetFactoryForChoices.process(processMethodContext);
facetFactoryForDisable.process(processMethodContext);
final Facet facet0 = facetHolderWithParms.getFacet(ActionInvocationFacet.class);
assertNotNull(facet0);