private ParametersRunnerFactory getParametersRunnerFactory() throws InstantiationException, IllegalAccessException { UseParametersRunnerFactory annotation = testClass .getAnnotation(UseParametersRunnerFactory.class); if (annotation == null) { return DEFAULT_FACTORY; } else { Class<? extends ParametersRunnerFactory> factoryClass = annotation .value(); return factoryClass.newInstance(); } }
protected ServiceTest[] getServices() { TestClass test = getTestClass(); ServiceTests config = test.getAnnotation(ServiceTests.class); if (config != null) return config.value(); Annotation[] annotations = test.getAnnotations(); List<ServiceTest> list = new ArrayList<>(); for (Annotation annotation : annotations) { if (ServiceTest.class.isAssignableFrom(annotation.getClass())) list.add((ServiceTest) annotation); } return list.toArray(new ServiceTest[list.size()]); }
public ConcurrentTestRunner(Class testClass) throws InitializationError { super(testClass); ConcurrentTestConfig configuration = getTestClass().getAnnotation(ConcurrentTestConfig.class); if (configuration == null) { runner = new LoopRunner(); return; } try { runner = configuration.runner().newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new InitializationError(e); } }
public boolean isExpectingBeforeClassException() { if (this.isExpectingBeforeClassException == null) { this.isExpectingBeforeClassException = getTestClass().getAnnotation(ExpectingBeforeClassException.class) != null; } return this.isExpectingBeforeClassException; }
private ConfigureWith getConfigureWithAnnotation() { ConfigureWith ret = this.getTestClass().getAnnotation(ConfigureWith.class); if (ret == null) ret = ConfigureWith.DEFAULT_INSTANCE; return ret; }
private ConfigureWith getConfigureWithAnnotation() { ConfigureWith ret = this.getTestClass().getAnnotation(ConfigureWith.class); if (ret == null) ret = ConfigureWith.DEFAULT_INSTANCE; return ret; }
public boolean isExpectingInstanciationException() { if(this.isExpectingInstanciationException == null) { this.isExpectingInstanciationException = getTestClass().getAnnotation(ExpectingInstanciationException.class) != null; } return this.isExpectingInstanciationException; }
private Http getHttpConfiguration() { Http http = this.getTestClass().getAnnotation(Http.class); if (http == null) http = HttpDefault.INSTANCE; return http; }
final protected ConfigurationBaratine getConfiguration() { ConfigurationBaratine config = getTestClass().getAnnotation(ConfigurationBaratine.class); if (config == null) { config = ConfigurationBaratineDefault.INSTANCE; } return config; }
private void prepareSetupTasks(TestClass klass) { try { if (klass.getJavaClass().isAnnotationPresent(ServerSetup.class)) { ServerSetup serverSetup = klass.getAnnotation(ServerSetup.class); for (Class<? extends ServerSetupTask> clazz : serverSetup.value()) { Constructor<? extends ServerSetupTask> ctor = clazz.getDeclaredConstructor(); ctor.setAccessible(true); serverSetupTasks.add(ctor.newInstance()); } } } catch (Exception e) { throw new RuntimeException(e); } }
protected void initGroupBy() { GroupBy annotation = getTestClass().getAnnotation(GroupBy.class); if (annotation != null) { groupByParam = annotation.value() == Group.PARAM; } }
protected void initGroupBy() { GroupBy annotation = getTestClass().getAnnotation(GroupBy.class); if (annotation != null) { groupByParam = annotation.value() == Group.PARAM; } }
private boolean shouldInitMockitoMocks() { TestClass testClass = this.getTestClass(); InitMocks initMocks = testClass.getAnnotation(InitMocks.class); if (initMocks != null) { return initMocks.value(); } return true; }
private Schema getSchema() throws InitializationError { Schema schema = getTestClass().getAnnotation(Schema.class); if (schema == null) { throw new InitializationError("Cannot read Schema"); } return schema; }
private Schema getSchema() throws InitializationError { Schema schema = getTestClass().getAnnotation(Schema.class); if (schema == null) { throw new InitializationError("Cannot read Schema"); } return schema; }
protected int getTestClassLoopsSleep() { return getLoopsSleep(getTestClass().getAnnotation(Repeat.class)); }
protected int getTestClassLoopsNbr() { return getLoopsNbr(getTestClass().getAnnotation(Repeat.class)); }
private static Class getParameterSpaceDefinitionClass(TestClass testClass) { ConfigureWith configureWith = testClass.getAnnotation(ConfigureWith.class); configureWith = configureWith == null ? ConfigureWith.DEFAULT_INSTANCE : configureWith; return Objects.equals(configureWith.parameterSpace(), Object.class) ? testClass.getJavaClass() : configureWith.parameterSpace(); }
private static Class getParameterSpaceDefinitionClass(TestClass testClass) { ConfigureWith configureWith = testClass.getAnnotation(ConfigureWith.class); configureWith = configureWith == null ? ConfigureWith.DEFAULT_INSTANCE : configureWith; return Objects.equals(configureWith.parameterSpace(), Object.class) ? testClass.getJavaClass() : configureWith.parameterSpace(); }
private ParametersRunnerFactory getParametersRunnerFactory() throws InstantiationException, IllegalAccessException { UseParametersRunnerFactory annotation = testClass .getAnnotation(UseParametersRunnerFactory.class); if (annotation == null) { return DEFAULT_FACTORY; } else { Class<? extends ParametersRunnerFactory> factoryClass = annotation .value(); return factoryClass.newInstance(); } }