private static boolean hasMethod(Class<?> objectClass, String methodName) {
    try {
      Method method = objectClass.getMethod(methodName);
      // currently only supports public method with zero parameters
      if (method.getParameterCount() == 0 &&
          Modifier.isPublic(method.getModifiers())) {
        return true;
      }
    } catch (NoSuchMethodException e) {
      // ignore
    }
    return false;
  }
Sets to the given value.

@param newValue the new value
@return a reference to this CloseableReference
geode-junit/src/main/java/org/apache/geode/test/junit/rules/CloseableReference.java