BeforeClass注释在远程服务器上使用Arquillian时调用方法两次
问题:在远程服务器上使用Arquillian时,如何避免BeforeClass注释被调用两次?
答案:要避免在远程服务器上使用Arquillian时BeforeClass注释被调用两次,可以尝试以下方法:
以下是一个示例:
import org.arquillian.container.api.Container;
import org.arquillian.container.api.InstanceProducer;
import org.arquillian.container.api.annotation.ArquillianContext;
import org.arquillian.container.api.annotation.ConfigurationPolicy;
import org.arquillian.container.api.container.ContainerConfiguration;
import org.arquillian.container.api.container.Context;
import org.arquillian.container.api.container.Startable;
import org.arquillian.container.api.context.ContextManagement;
import org.arquillian.container.api.context.ContextSet;
import org.arquillian.container.spi.ContainerPlugin;
import org.arquillian.container.spi.ContainerPluginContext;
import org.arquillian.container.spi.ContainerPluginStart;
import org.arquillian.container.spi.ContextConfiguration;
import org.arquillian.container.spi.ContextManagementAndConfiguration;
import org.arquillian.container.spi.StartableContainer;
import org.arquillian.container.spi.annotation.ContainerAnnotationProcessor;
import org.arquillian.container.spi.annotation.Context;
import org.arquillian.container.spi.annotation.Inject;
import org.arquillian.container.spi.annotation.InjectResource;
import org.arquillian.container.spi.annotation.Label;
import org.arquillian.container.spi.annotation.Priority;
import org.arquillian.container.spi.config.Configuration;
import org.arquillian.container.spi.config.ConfigurationManagement;
import org.arquillian.container.spi.config.InvalidConfigurationException;
import org.arquillian.container.spi.context.ContainerContext;
import org.arquillian.container.spi.context.Context;
import org.arquillian.container.spi.context.EmptyContext;
import org.arquillian.container.spi.context.InvalidContextException;
import org.arquillian.container.spi.start.ContainerStart;
import org.arquillian.container.spi.start.StartableContainerProvider;
import org.arquillian.container.spi.strategy.ContextCreationStrategy;
import org.arquillian.container.spi.strategy.InstanceCreationStrategy;
import org.arquillian.container.spi.strategy.PluginContextCreationStrategy;
import org.arquillian.container.spi.strategy.PluginInstanceCreationStrategy;
import org.arquillian.container.spi.type.ContainerPluginType;
import org.arquillian.container.spi.type.ContainerType;
import org.arquillian.container.spi.type.ResourceType;
import org.arquillian.container.test.api.ContextConfigurationBuilder;
import org.arquillian.container.test.api.ContextManagementStrategy;
import org.arquillian.container.test.api.InstanceManagementStrategy;
import org.arquillian.container.test.api.PluginContextManagementStrategy;
import org.arquillian.container.test.api.PluginInstanceManagementStrategy;
import org.arquillian.container.test.api.annotation.Container;
import org.arquillian.container.test.api.annotation.ContainerClass;
import org.arquillian.container.test.api.annotation.ContainerId;
import org.arquillian.container.test.api.annotation.ContainerSequence;
import org.arquillian.
领取专属 10元无门槛券
手把手带您无忧上云