Search in sources :

Example 1 with RepeatedTest

use of org.junit.jupiter.api.RepeatedTest in project junit5 by junit-team.

the class RepeatedTestExtension method provideTestTemplateInvocationContexts.

@Override
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context) {
    Method testMethod = context.getRequiredTestMethod();
    String displayName = context.getDisplayName();
    RepeatedTest repeatedTest = AnnotationUtils.findAnnotation(testMethod, RepeatedTest.class).get();
    int totalRepetitions = totalRepetitions(repeatedTest, testMethod);
    RepeatedTestDisplayNameFormatter formatter = displayNameFormatter(repeatedTest, testMethod, displayName);
    // @formatter:off
    return IntStream.rangeClosed(1, totalRepetitions).mapToObj(repetition -> new RepeatedTestInvocationContext(repetition, totalRepetitions, formatter));
// @formatter:on
}
Also used : RepeatedTest(org.junit.jupiter.api.RepeatedTest) Method(java.lang.reflect.Method)

Example 2 with RepeatedTest

use of org.junit.jupiter.api.RepeatedTest in project component-runtime by Talend.

the class JUnit5HttpsApiTest method getProxy.

// just ensure it is reentrant
@RepeatedTest(5)
void getProxy() throws Exception {
    final Response response = get();
    assertEquals(HttpURLConnection.HTTP_OK, response.status());
    assertEquals(new String(response.payload()), "worked as expected");
    assertEquals("text/plain", response.headers().get("content-type"));
    assertEquals("true", response.headers().get("mocked"));
    assertEquals("true", response.headers().get("X-Talend-Proxy-JUnit"));
}
Also used : Response(org.talend.sdk.component.junit.http.api.Response) RepeatedTest(org.junit.jupiter.api.RepeatedTest)

Aggregations

RepeatedTest (org.junit.jupiter.api.RepeatedTest)2 Method (java.lang.reflect.Method)1 Response (org.talend.sdk.component.junit.http.api.Response)1