All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spock.mock.IMockMakerSettings Maven / Gradle / Ivy

Go to download

Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd is its beautiful and highly expressive specification language. Thanks to its JUnit runner, Spock is compatible with most IDEs, build tools, and continuous integration servers. Spock is inspired from JUnit, jMock, RSpec, Groovy, Scala, Vulcans, and other fascinating life forms.

There is a newer version: 2.4-M4-groovy-4.0
Show newest version
package spock.mock;

import groovy.lang.Closure;
import org.spockframework.mock.runtime.IMockMaker;
import org.spockframework.util.Beta;

/**
 * Settings passed to the {@link IMockMaker} and created explicitly for the requested mock maker.
 * The user will create such an instance at the mocking site:
 *
 * 

{@code Mock(mockMaker: yourMockSettings { yourProperty = true }, ClassToMock)} * *

The {@link IMockMaker} should define a static constant or method (see {@link MockMakers}), * which let the user construct a custom {@link IMockMakerSettings}. * *

If you provide a method, you can define your settings in a typesafe manner for the user, * e.g. with a {@link Closure} parameter to configure the mock. * * @since 2.4 */ @Beta public interface IMockMakerSettings { /** * Creates a default {@code IMockMakerSettings} object with only an {@link MockMakerId}. * * @param id the mock maker ID. * @return the settings object */ static IMockMakerSettings settingsFor(MockMakerId id) { return new IMockMakerSettings() { @Override public MockMakerId getMockMakerId() { return id; } @Override public String toString() { return id + " default mock maker settings"; } }; } MockMakerId getMockMakerId(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy