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

io.dropwizard.testing.junit.ResourceTestJerseyConfiguration Maven / Gradle / Ivy

There is a newer version: 5.0.0-rc.1
Show newest version
package io.dropwizard.testing.junit;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.test.spi.TestContainerFactory;

import javax.validation.Validator;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;

/**
 * A configuration of a Jersey testing environment.
 * Encapsulates data required to configure a {@link ResourceTestRule}.
 * Primarily accessed via {@link DropwizardTestResourceConfig}.
 */
class ResourceTestJerseyConfiguration {

    final Set singletons;
    final Set> providers;
    final Map properties;
    final ObjectMapper mapper;
    final Validator validator;
    final Consumer clientConfigurator;
    final TestContainerFactory testContainerFactory;
    final boolean registerDefaultExceptionMappers;

    ResourceTestJerseyConfiguration(Set singletons, Set> providers, Map properties,
                                    ObjectMapper mapper, Validator validator, Consumer clientConfigurator,
                                    TestContainerFactory testContainerFactory, boolean registerDefaultExceptionMappers) {
        this.singletons = singletons;
        this.providers = providers;
        this.properties = properties;
        this.mapper = mapper;
        this.validator = validator;
        this.clientConfigurator = clientConfigurator;
        this.testContainerFactory = testContainerFactory;
        this.registerDefaultExceptionMappers = registerDefaultExceptionMappers;
    }

    String getId() {
        return String.valueOf(hashCode());
    }
}