use of org.junit.runners.model.Statement in project restfuse by eclipsesource.
the class HttpTestStatement_Test method testRemovesProxyProperties.
@Test
public void testRemovesProxyProperties() throws Throwable {
Statement base = mock(Statement.class);
Description description = mock(Description.class);
HttpTest annotation = createAnnotation();
when(description.getAnnotation(HttpTest.class)).thenReturn(annotation);
Object target = new Object();
HttpTestStatement statement = new HttpTestStatement(base, description, target, "http://localhost", "http://proxy.com", 8080, null);
statement.evaluate();
assertNull(System.getProperty(HttpTestStatement.HTTP_PROXY_HOST));
assertNull(System.getProperty(HttpTestStatement.HTTP_PROXY_PORT));
}
use of org.junit.runners.model.Statement in project restfuse by eclipsesource.
the class Destination method apply.
@Override
public /**
* <p><b>Not meant for public use. This method will be invoked by the JUnit framework.</b></p>
*/
Statement apply(Statement base, Description description) {
Statement result;
if (hasAnnotation(description)) {
requestStatement = new HttpTestStatement(base, description, testObject, baseUrl, proxyHost, proxyPort, context);
result = requestStatement;
} else {
result = base;
}
return result;
}
use of org.junit.runners.model.Statement in project restfuse by eclipsesource.
the class HttpTestStatement method doEvaluate.
private void doEvaluate() throws Throwable {
Statement delegate = new BasicStatement(base, this);
if (needsCallback()) {
delegate = new CallbackStatement(base, this, description, target);
} else if (needsPoll()) {
delegate = new PollStatement(base, this, description, target);
}
delegate.evaluate();
}
use of org.junit.runners.model.Statement in project vert.x by eclipse.
the class RepeatRule method apply.
@Override
public Statement apply(Statement statement, Description description) {
Statement result = statement;
Repeat repeat = description.getAnnotation(Repeat.class);
if (repeat != null) {
int times = repeat.times();
result = new RepeatStatement(times, statement);
}
return result;
}
use of org.junit.runners.model.Statement in project gradle by gradle.
the class Sample method apply.
public Statement apply(final Statement base, FrameworkMethod method, Object target) {
sampleName = getSampleName(method);
return new Statement() {
@Override
public void evaluate() throws Throwable {
if (sampleName != null) {
String hintForMissingSample = String.format("If '%s' is a new sample, try running 'gradle intTestImage'.", sampleName);
TestFile srcDir = new IntegrationTestBuildContext().getSamplesDir().file(sampleName).assertIsDir(hintForMissingSample);
logger.debug("Copying sample '{}' to test directory.", sampleName);
srcDir.copyTo(getDir());
} else {
logger.debug("No sample specified for this test, skipping.");
}
base.evaluate();
}
};
}
Aggregations