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);
}
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;
}
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;
}
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);
}
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);
}
Aggregations