@SuppressWarnings("unchecked")
  public <T> T createMock(@Nullable String name, Class<T> type, MockNature nature, Map<String, Object> options) {
    ClassLoader classLoader = type.getClassLoader();
    if (classLoader == null) {
      classLoader = ClassLoader.getSystemClassLoader();
    }
    return (T) new MockUtil().createDetachedMock(name, type, nature, MockImplementation.JAVA, options, classLoader);
  }
Creates a spy with the specified options and type. The mock name will be the types simple name.

Example:

<pre>
  def person = Spy(Person, name: "myPerson") // type is Person.class, name is "myPerson"
</pre>

@param options optional options for creating the spy
@param type the class type of the spy
@param <T> the class type of the spy

@return a spy with the specified options and type
spock-core/src/main/java/spock/mock/DetachedMockFactory.java