import org.apache.isis.core.progmodel.facets.value.bigdecimal.BigDecimalValueFacet;
public class JavaxValidationDigitsAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
public void testAnnotationPickedUpOnProperty() {
final BigDecimalForPropertyDerivedFromJavaxValidationDigitsFacetFactory facetFactory = new BigDecimalForPropertyDerivedFromJavaxValidationDigitsFacetFactory();
class Order {
@SuppressWarnings("unused")
@javax.validation.constraints.Digits(integer=14, fraction=4)
public BigDecimal getCost() {
return null;
}
}
final Method method = findMethod(Order.class, "getCost");
facetFactory.process(new ProcessMethodContext(Order.class, null, null, method, methodRemover, facetedMethod));
final Facet facet = facetedMethod.getFacet(BigDecimalValueFacet.class);
assertNotNull(facet);
assertTrue(facet instanceof BigDecimalFacetForPropertyFromJavaxValidationDigitsAnnotation);
final BigDecimalFacetForPropertyFromJavaxValidationDigitsAnnotation annotation = (BigDecimalFacetForPropertyFromJavaxValidationDigitsAnnotation) facet;