### Question:
JsdUtil { static String getName(final Method getMethod) { for (final Annotation annotation : getMethod.getAnnotations()) { if (annotation instanceof AnyProperty) return ((AnyProperty)annotation).name(); if (annotation instanceof ArrayProperty) return ((ArrayProperty)annotation).name(); if (annotation instanceof BooleanProperty) return ((BooleanProperty)annotation).name(); if (annotation instanceof NumberProperty) return ((NumberProperty)annotation).name(); if (annotation instanceof ObjectProperty) return ((ObjectProperty)annotation).name(); if (annotation instanceof StringProperty) return ((StringProperty)annotation).name(); } return null; } private  JsdUtil();   }### Answer:
@Test public void testGetName() throws NoSuchMethodException { assertNull(JsdUtil.getName(getMethod(NoProperty.class, "noProperty"))); assertEquals("foo", JsdUtil.getName(getMethod(InvalidName.class, "invalidName"))); assertEquals("invalidAnnotation", JsdUtil.getName(getMethod(Bool.class, "invalidAnnotation"))); assertEquals("invalidAnnotation", JsdUtil.getName(getMethod(Num.class, "invalidAnnotation"))); assertEquals("invalidAnnotationType", JsdUtil.getName(getMethod(ArrAnnotationType.class, "invalidAnnotationType"))); assertEquals("address", JsdUtil.getName(getMethod(Library.class, "address"))); }