private Method findMethod(String name, MethodKind kind) {
    List<Method> methods = Arrays.stream(spec.getReflection().getDeclaredMethods()).filter(m -> m.getName().equals(name)).collect(Collectors.toList());
    if (methods.isEmpty()) {return null;}
    if (methods.size() > 1) {
      methods.sort(comparingInt(Method::getParameterCount));
      throw new SpockException(String.format("Multiple %s methods found in '%s'. Methods %s. There can only be one per specification class.", kind, spec.getReflection().getName(), methods));
    }

    Method method = methods.get(0);
    method.setAccessible(true);
    return method;
  }
Builds a SpecInfo from a Class instance.

@author Peter Niederwieser
spock-core/src/main/java/org/spockframework/runtime/SpecInfoBuilder.java