use of java.lang.reflect.Parameter in project junit-servers by mjeanroy.
the class JunitServerExtensionTest method verifySupportsParameter.
private void verifySupportsParameter(String methodName, Class<?> klass) throws Exception {
final JunitServerExtension extension = new JunitServerExtension();
final FixtureClass testInstance = new FixtureClass();
final FakeExtensionContext context = new FakeExtensionContext(testInstance);
extension.beforeAll(context);
final Method method = getClass().getMethod(methodName, klass);
final Parameter parameter = method.getParameters()[0];
final ParameterContext parameterContext = new FakeParameterContext(parameter);
assertThat(extension.supportsParameter(parameterContext, context)).isTrue();
}
use of java.lang.reflect.Parameter in project junit-servers by mjeanroy.
the class CaptureSystemOutExtension method supportsParameter.
@Override
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
Parameter parameter = parameterContext.getParameter();
Class<?> parameterType = parameter.getType();
return CaptureSystemOut.class.isAssignableFrom(parameterType);
}
use of java.lang.reflect.Parameter in project junit-servers by mjeanroy.
the class WireMockExtension method supportsParameter.
@Override
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
Parameter parameter = parameterContext.getParameter();
Class<?> parameterType = parameter.getType();
return WireMockServer.class.isAssignableFrom(parameterType);
}
use of java.lang.reflect.Parameter in project junit-servers by mjeanroy.
the class JunitServerExtension method supportsParameter.
@Override
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
final Parameter parameter = parameterContext.getParameter();
final Class<?> parameterClass = parameter.getType();
// Fast case: a perfect match.
if (RESOLVERS.containsKey(parameterClass)) {
return true;
}
for (Class<?> klass : RESOLVERS.keySet()) {
if (klass.isAssignableFrom(parameterClass)) {
return true;
}
}
return false;
}
use of java.lang.reflect.Parameter in project dbunit-plus by mjeanroy.
the class DbUnitExtension method supportsParameter.
@Override
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
final Parameter parameter = parameterContext.getParameter();
final Class<?> parameterClass = parameter.getType();
return Connection.class.isAssignableFrom(parameterClass);
}
Aggregations