Search in sources :

Example 81 with DataProvider

use of com.tngtech.java.junit.dataprovider.DataProvider in project Hystrix by Netflix.

the class FallbackMethodTest method testGetFallbackForExtendedCommand.

@Test
@DataProvider({ "true", "false" })
public void testGetFallbackForExtendedCommand(boolean extended) throws NoSuchMethodException {
    // given
    Method extFallback = Service.class.getDeclaredMethod("extCommand", String.class, Integer.class, Throwable.class);
    // when
    Method fallback = MethodProvider.getInstance().getFallbackMethod(Service.class, extFallback, extended).getMethod();
    // then
    assertParamsTypes(fallback, String.class, Integer.class, Throwable.class);
}
Also used : Method(java.lang.reflect.Method) DataProvider(com.tngtech.java.junit.dataprovider.DataProvider) Test(org.junit.Test)

Example 82 with DataProvider

use of com.tngtech.java.junit.dataprovider.DataProvider in project sonarqube by SonarSource.

the class BuildComponentTreeStepTest method allComponentTypes.

@DataProvider
public static Object[][] allComponentTypes() {
    Object[][] res = new Object[ComponentType.values().length - 2][1];
    int i = 0;
    for (ComponentType componentType : from(asList(ComponentType.values())).filter(not(in(asList(UNSET, UNRECOGNIZED))))) {
        res[i][0] = componentType;
        i++;
    }
    return res;
}
Also used : ComponentType(org.sonar.scanner.protocol.output.ScannerReport.Component.ComponentType) DataProvider(com.tngtech.java.junit.dataprovider.DataProvider) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Example 83 with DataProvider

use of com.tngtech.java.junit.dataprovider.DataProvider in project sonarqube by SonarSource.

the class CeUserSessionTest method ceUserSessionPublicMethods.

@DataProvider
public static Object[][] ceUserSessionPublicMethods() {
    List<Method> declaredMethods = from(asList(CeUserSession.class.getDeclaredMethods())).filter(PublicMethodPredicate.INSTANCE).toList();
    Object[][] res = new Object[declaredMethods.size()][1];
    int i = 0;
    for (Method declaredMethod : declaredMethods) {
        res[i][0] = declaredMethod;
        i++;
    }
    return res;
}
Also used : Method(java.lang.reflect.Method) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider) DataProvider(com.tngtech.java.junit.dataprovider.DataProvider)

Example 84 with DataProvider

use of com.tngtech.java.junit.dataprovider.DataProvider in project riposte by Nike-Inc.

the class RoutingHandlerTest method doChannelRead_HttpRequest_does_not_throw_TooLongFrameException_if_content_length_is_less_than_endpoint_overridden_value.

@DataProvider(value = { "99", "100" })
@Test
public void doChannelRead_HttpRequest_does_not_throw_TooLongFrameException_if_content_length_is_less_than_endpoint_overridden_value(int maxRequestSize) {
    // given
    doReturn(100).when(endpointMock).maxRequestSizeInBytesOverride();
    httpHeaders.set(CONTENT_LENGTH, 100);
    handlerSpy = spy(new RoutingHandler(endpoints, maxRequestSize));
    // when
    PipelineContinuationBehavior result = handlerSpy.doChannelRead(ctxMock, msg);
    // then
    assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
}
Also used : PipelineContinuationBehavior(com.nike.riposte.server.handler.base.PipelineContinuationBehavior) DataProvider(com.tngtech.java.junit.dataprovider.DataProvider) Test(org.junit.Test)

Example 85 with DataProvider

use of com.tngtech.java.junit.dataprovider.DataProvider in project riposte by Nike-Inc.

the class RoutingHandlerTest method doChannelRead_HttpRequest_does_not_throw_TooLongFrameException_if_content_length_header_is_missing.

@DataProvider(value = { "true", "false" })
@Test
public void doChannelRead_HttpRequest_does_not_throw_TooLongFrameException_if_content_length_header_is_missing(boolean isChunkedTransferEncoding) {
    // given
    if (isChunkedTransferEncoding) {
        httpHeaders.set(TRANSFER_ENCODING, CHUNKED);
    }
    doReturn(null).when(endpointMock).maxRequestSizeInBytesOverride();
    maxRequestSizeInBytes = 101;
    handlerSpy = spy(new RoutingHandler(endpoints, maxRequestSizeInBytes));
    // when
    PipelineContinuationBehavior result = handlerSpy.doChannelRead(ctxMock, msg);
    // then
    assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
}
Also used : PipelineContinuationBehavior(com.nike.riposte.server.handler.base.PipelineContinuationBehavior) DataProvider(com.tngtech.java.junit.dataprovider.DataProvider) Test(org.junit.Test)

Aggregations

DataProvider (com.tngtech.java.junit.dataprovider.DataProvider)88 Test (org.junit.Test)85 PipelineContinuationBehavior (com.nike.riposte.server.handler.base.PipelineContinuationBehavior)20 Span (com.nike.wingtips.Span)19 Assertions.catchThrowable (org.assertj.core.api.Assertions.catchThrowable)19 Matchers.anyString (org.mockito.Matchers.anyString)11 HttpMethod (io.netty.handler.codec.http.HttpMethod)9 Endpoint (com.nike.riposte.server.http.Endpoint)8 Timer (com.codahale.metrics.Timer)7 StandardEndpoint (com.nike.riposte.server.http.StandardEndpoint)7 HashMap (java.util.HashMap)7 Map (java.util.Map)7 RequestInfo (com.nike.riposte.server.http.RequestInfo)5 Charset (java.nio.charset.Charset)5 CompletableFuture (java.util.concurrent.CompletableFuture)5 Meter (com.codahale.metrics.Meter)4 Response (com.ning.http.client.Response)4 ExtractableResponse (io.restassured.response.ExtractableResponse)4 Deque (java.util.Deque)4 Optional (java.util.Optional)4