Search in sources :

Example 1 with MockitoLogger

use of org.mockito.plugins.MockitoLogger in project mockito by mockito.

the class DefaultMockitoSessionBuilder method startMocking.

@Override
public MockitoSession startMocking() {
    // Configure default values
    List<Object> effectiveTestClassInstances;
    String effectiveName;
    if (testClassInstances.isEmpty()) {
        effectiveTestClassInstances = emptyList();
        effectiveName = this.name == null ? "<Unnamed Session>" : this.name;
    } else {
        effectiveTestClassInstances = new ArrayList<>(testClassInstances);
        Object lastTestClassInstance = testClassInstances.get(testClassInstances.size() - 1);
        effectiveName = this.name == null ? lastTestClassInstance.getClass().getName() : this.name;
    }
    Strictness effectiveStrictness = this.strictness == null ? Strictness.STRICT_STUBS : this.strictness;
    MockitoLogger logger = this.logger == null ? Plugins.getMockitoLogger() : new MockitoLoggerAdapter(this.logger);
    return new DefaultMockitoSession(effectiveTestClassInstances, effectiveName, effectiveStrictness, logger);
}
Also used : DefaultMockitoSession(org.mockito.internal.framework.DefaultMockitoSession) MockitoLogger(org.mockito.plugins.MockitoLogger) Strictness(org.mockito.quality.Strictness)

Aggregations

DefaultMockitoSession (org.mockito.internal.framework.DefaultMockitoSession)1 MockitoLogger (org.mockito.plugins.MockitoLogger)1 Strictness (org.mockito.quality.Strictness)1