public void testMaskAnnotationNotIgnoredForNonStringsProperty() { final MaskFacetOnPropertyAnnotationFactory facetFactory = new MaskFacetOnPropertyAnnotationFactory(); facetFactory.setSpecificationLoader(programmableReflector); class Customer { @SuppressWarnings("unused") @Mask("###") public int getNumberOfOrders() { return 0; } } final Method method = findMethod(Customer.class, "getNumberOfOrders"); facetFactory.process( new ProcessMethodContext(Customer.class, null, null, method, methodRemover, facetedMethod)); assertNotNull(facetedMethod.getFacet(MaskFacet.class)); }
public void testMaskAnnotationPickedUpOnProperty() { final MaskFacetOnPropertyAnnotationFactory facetFactory = new MaskFacetOnPropertyAnnotationFactory(); facetFactory.setSpecificationLoader(programmableReflector); class Customer { @SuppressWarnings("unused") @Mask("###") public String getFirstName() { return null; } } final Method method = findMethod(Customer.class, "getFirstName"); facetFactory.process( new ProcessMethodContext(Customer.class, null, null, method, methodRemover, facetedMethod)); final Facet facet = facetedMethod.getFacet(MaskFacet.class); assertNotNull(facet); assertTrue(facet instanceof MaskFacetOnPropertyAnnotation); final MaskFacetOnPropertyAnnotation maskFacet = (MaskFacetOnPropertyAnnotation) facet; assertEquals("###", maskFacet.value()); }