Example #1
0
 private Method checkThatSingletonContainsStaticInstanceAccessorMethod(Class clazz) {
   for (Method method : clazz.getDeclaredMethods()) {
     if (method.getReturnType() == clazz && method.getParameterTypes().length == 0) {
       assertTrue(
           "Method returning the Earth instance should be static",
           Modifier.isStatic(method.getModifiers()));
       return method;
     }
   }
   fail("No static accessor method found.");
   return null; // will never be called.
 }