final TypeOfFacetInferredFromSupportingMethods typeOfFacetInferredFromSupportingMethods = (TypeOfFacetInferredFromSupportingMethods) facet;
assertEquals(Order.class, typeOfFacetInferredFromSupportingMethods.value());
}
public void testClearFacetIsInstalledAndMethodRemoved() {
final CollectionClearFacetFactory facetFactory = new CollectionClearFacetFactory();
facetFactory.setSpecificationLookup(reflector);
@SuppressWarnings({ "hiding", "unused" })
class Order {
}
class Customer {
@SuppressWarnings({ "rawtypes", "unused" })
public Collection getOrders() {
return null;
}
@SuppressWarnings("unused")
public void clearOrders() {
};
}
final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
final Method clearMethod = findMethod(Customer.class, "clearOrders");
facetFactory.process(new ProcessMethodContext(Customer.class, null, null, collectionAccessorMethod, methodRemover, facetedMethod));
final Facet facet = facetedMethod.getFacet(CollectionClearFacet.class);
assertNotNull(facet);
assertTrue(facet instanceof CollectionClearFacetViaClearMethod);
final CollectionClearFacetViaClearMethod collectionClearFacetViaClearMethod = (CollectionClearFacetViaClearMethod) facet;