}
private static Class<?> startServerAndIsolateClass(Class<?> klass) throws InitializationError {
DevAppServerTest testAnno = klass.getAnnotation(DevAppServerTest.class);
if (testAnno == null) {
throw new InitializationError(String.format(
"Test uses %s but is not also annotated with %s.",
DevAppServerTestRunner.class.getSimpleName(), DevAppServerTest.class.getSimpleName()));
}
try {
DevAppServerTestConfig config = testAnno.value().newInstance();
DevAppServer devServer = DevAppServerTestHelper.startServer(config);
return devServer.getAppContext().getClassLoader().loadClass(klass.getName());
} catch (InstantiationException e) {
throw new InitializationError(e);
} catch (IllegalAccessException e) {
throw new InitializationError(e);
} catch (ClassNotFoundException e) {
throw new InitializationError(e);
}
}