Testsuite question
by Ron Sigal
This question arises from RESTEASY-1617 "Add support for injection in
constraint validators on Java SE". We already use a CDI aware
ValidatorFactory in the context of Wildfly / EAP, but not in Java SE.
My question is: where do I test this new facility? I've got a test that
makes an invocation to an embedded instance of Undertow. We have
resteasy-integration-tests for running tests on Wildfly, which isn't
appropriate in this case. We also have resteasy-unit-tests, but my
understanding is that it's not for tests that make network invocations.
We could create a new test module for running tests with embedded
servers. Or I could just put it in resteasy-integration-tests and forget
about it.
It's not a big deal, but I'm open to suggestions.
Thanks,
Ron
--
My company's smarter than your company (unless you work for Red Hat)
7 years, 5 months
Lambda question
by Ron Sigal
This question arises in https://issues.jboss.org/browse/RESTEASY-1209
"org.jboss.resteasy.util.Types#getActualTypeArgumentsOfAnInterface not
working for lambda's." The reporter wants to do this:
> ResteasyProviderFactory factory = new ResteasyProviderFactory();
> factory.register((ContextResolver<String>) type -> "foo bar");
but it doesn't work. I find that if I do this:
> ContextResolver<String> resolver1 = new
> ContextResolver<String>() {
>
> @Override
> public String getContext(Class<?> type)
> {
> return null;
> }
> };
> for (Type type : resolver1.getClass().getGenericInterfaces())
> {
> System.out.println(type);
> }
I get
> javax.ws.rs.ext.ContextResolver<java.lang.String>
but if I do
> ContextResolver<String> resolver2 = type -> "foo";
> for (Type type : resolver2.getClass().getGenericInterfaces())
> {
> System.out.println(type);
> }
I get
> interface javax.ws.rs.ext.ContextResolver
Same with
> ContextResolver<String> resolver2 =
> ((ContextResolver<String>)type -> "foo");
So, it seems that, for lambdas, Java doesn't keep the implementation
type and value of the type variable at run time. Does anyone have any
ideas or tricks?
Thanks,
Ron
--
My company's smarter than your company (unless you work for Red Hat)
7 years, 5 months