private Statement statement(final Statement base, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
Server server = description.getAnnotation(Server.class);
ServerProcessor processor = null;
if (server != null) {
Class<?> testClass = description.getTestClass();
processor = new ServerProcessor(server, testClass);
processor.initServer();
}
try {
base.evaluate();
} finally {
if (processor != null) {
processor.stopServer();
}
}
}
};
}