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

com.playtika.testcontainer.selenium.testscope.TestcontainerContextCustomizerFactory Maven / Gradle / Ivy

package com.playtika.testcontainer.selenium.testscope;

import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.ContextConfigurationAttributes;
import org.springframework.test.context.ContextCustomizer;
import org.springframework.test.context.ContextCustomizerFactory;
import org.springframework.test.context.MergedContextConfiguration;

import java.util.List;

public class TestcontainerContextCustomizerFactory implements ContextCustomizerFactory {
    @Override
    public ContextCustomizer createContextCustomizer(Class testClass,
                                                     List configAttributes) {
        return new Customizer();
    }

    private static class Customizer implements ContextCustomizer {

        @Override
        public void customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) {
            TestcontainerScope.registerWith(context);
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == this) {
                return true;
            }
            if (obj == null || obj.getClass() != getClass()) {
                return false;
            }
            return true;
        }

        @Override
        public int hashCode() {
            return getClass().hashCode();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy