Throwable thrownImpl(String inferredName, Class<? extends Throwable> inferredType, Class<? extends Throwable> specifiedType) { return checkExceptionThrown(specifiedType); }
@Beta public Object createMock(@Nullable String name, Type type, MockNature nature, MockImplementation implementation, Map<String, Object> options, @Nullable Closure closure) { return createMock(name, null, type, nature, implementation, options, closure); }
private Object createMockImpl(String inferredName, Class<?> inferredType, MockNature nature, MockImplementation implementation, Map<String, Object> options, Class<?> specifiedType, Closure closure) { return createMockImpl(inferredName, inferredType, null, nature, implementation, options, specifiedType, closure); }
private Object createMockImpl(String inferredName, Class<?> inferredType, Object instance, MockNature nature, MockImplementation implementation, Map<String, Object> options, Class<?> specifiedType, Closure closure) { Type effectiveType = specifiedType != null ? specifiedType : options.containsKey("type") ? (Type) options.get("type") : inferredType; if (effectiveType == null) { throw new InvalidSpecException("Mock object type cannot be inferred automatically. " + "Please specify a type explicitly (e.g. 'Mock(Person)')."); } return createMock(inferredName, instance, effectiveType, nature, implementation, options, closure); } }
Object MockImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) { return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.JAVA, options, null, null); }
Throwable thrownImpl(String inferredName, Class<? extends Throwable> inferredType) { if (inferredType == null) { throw new InvalidSpecException("Thrown exception type cannot be inferred automatically. " + "Please specify a type explicitly (e.g. 'thrown(MyException)')."); } return checkExceptionThrown(inferredType); }
Object StubImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) { return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.JAVA, options, null, null); }
Object SpyImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType) { return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.JAVA, options, specifiedType, null); }
Object GroovyMockImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) { return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.GROOVY, options, null, null); }
Object GroovyMockImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Closure closure) { return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.GROOVY, options, null, closure); }
Object GroovySpyImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) { return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.GROOVY, options, null, null); }
Object GroovySpyImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType) { return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.GROOVY, options, specifiedType, null); }
Object MockImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType) { return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.JAVA, options, specifiedType, null); }
Object SpyImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) { return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.JAVA, options, null, null); }
Object SpyImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType, Closure closure) { return createMockImpl(inferredName, inferredType, MockNature.SPY, MockImplementation.JAVA, options, specifiedType, closure); }
Object GroovyMockImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType) { return createMockImpl(inferredName, inferredType, MockNature.MOCK, MockImplementation.GROOVY, options, specifiedType, null); }
Object GroovyStubImpl(String inferredName, Class<?> inferredType, Map<String, Object> options) { return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, options, null, null); }
Object GroovyStubImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Closure closure) { return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, options, null, closure); }
Object GroovyStubImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType) { return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, options, specifiedType, null); }
Object GroovyStubImpl(String inferredName, Class<?> inferredType, Map<String, Object> options, Class<?> specifiedType, Closure closure) { return createMockImpl(inferredName, inferredType, MockNature.STUB, MockImplementation.GROOVY, options, specifiedType, closure); }