mardi 21 mai 2019

Testing Rest API with Arquillian ProxyException

I have testsets for my REST-api, setup and server are working fine. But all my negativ test-cases(status codes 400,500) are not working when I change the status code manual to 200 they throw no errors.

In my research i found out that JAX-RS exception hierarchy is not usable in service classes, in the context of arquilian tests. So im looking for an workaround for negativ testing

Error-code:

org.jboss.arquillian.test.spi.ArquillianProxyException: javax.ws.rs.WebApplicationException : Unknown error, status code 500 [Proxied because : Original exception caused: class java.io.NotSerializableException: java.io.ByteArrayInputStream]

at io.smallrye.restclient@1.2.2//io.smallrye.restclient.DefaultResponseExceptionMapper.toThrowable(DefaultResponseExceptionMapper.java:35)
at io.smallrye.restclient@1.2.2//io.smallrye.restclient.ExceptionMapping.lambda$filter$0(ExceptionMapping.java:60)
at java.base/java.util.HashMap.forEach(HashMap.java:1336)
at io.smallrye.restclient@1.2.2//io.smallrye.restclient.ExceptionMapping.filter(ExceptionMapping.java:59)
at org.jboss.resteasy.resteasy-jaxrs@3.6.2.Final//org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.filterResponse(ClientInvocation.java:618)
at org.jboss.resteasy.resteasy-jaxrs@3.6.2.Final//org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:440)
at org.jboss.resteasy.resteasy-jaxrs@3.6.2.Final//org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invokeSync(ClientInvoker.java:148)
at org.jboss.resteasy.resteasy-jaxrs@3.6.2.Final//org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:112)
at org.jboss.resteasy.resteasy-jaxrs@3.6.2.Final//org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
at deployment.test.war//com.sun.proxy.$Proxy144.eventAssign(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.smallrye.restclient@1.2.2//io.smallrye.restclient.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:161)
at deployment.test.war//com.sun.proxy.$Proxy145.eventAssign(Unknown Source)
at deployment.test.war//com.gepardec.merkurbooster.CustomerEventBasicTest.testEventAssign(CustomerEventBasicTest.java:106)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at deployment.test.war//org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at deployment.test.war//org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at deployment.test.war//org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian$8$1.invoke(Arquillian.java:334)
at org.jboss.arquillian@1.1.15.Final//org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:57)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at deployment.test.war//org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90)
at deployment.test.war//org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133)
at deployment.test.war//org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:105)
at deployment.test.war//org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:62)
at org.jboss.arquillian@1.1.15.Final//org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:36)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at deployment.test.war//org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90)
at org.jboss.arquillian@1.1.15.Final//org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:116)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at deployment.test.war//org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
at org.jboss.arquillian@1.1.15.Final//org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:83)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at deployment.test.war//org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
at org.jboss.arquillian@1.1.15.Final//org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:69)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at deployment.test.war//org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
at deployment.test.war//org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133)
at org.jboss.arquillian@1.1.15.Final//org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:122)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian$8.evaluate(Arquillian.java:330)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:212)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:376)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:223)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian$7$1.invoke(Arquillian.java:287)
at org.jboss.arquillian@1.1.15.Final//org.jboss.arquillian.container.test.impl.execution.BeforeLifecycleEventExecuter.on(BeforeLifecycleEventExecuter.java:34)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at deployment.test.war//org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90)
at org.jboss.arquillian@1.1.15.Final//org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:116)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at deployment.test.war//org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
at org.jboss.arquillian@1.1.15.Final//org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:83)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at deployment.test.war//org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
at org.jboss.arquillian@1.1.15.Final//org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:69)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at deployment.test.war//org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
at deployment.test.war//org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
at deployment.test.war//org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133)
at deployment.test.war//org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:105)
at org.jboss.arquillian@1.1.15.Final//org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.fireCustomLifecycle(EventTestRunnerAdaptor.java:142)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian$7.evaluate(Arquillian.java:281)
at deployment.test.war//org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at deployment.test.war//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at deployment.test.war//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at deployment.test.war//org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at deployment.test.war//org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at deployment.test.war//org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at deployment.test.war//org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at deployment.test.war//org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:174)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:376)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:185)
at deployment.test.war//org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at deployment.test.war//org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:140)
at deployment.test.war//org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at deployment.test.war//org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at deployment.test.war//org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:61)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.wildfly.swarm.arquillian.daemon@2.4.0.Final//org.wildfly.swarm.arquillian.daemon.TestRunner.executeTest(TestRunner.java:64)
at org.wildfly.swarm.arquillian.daemon@2.4.0.Final//org.wildfly.swarm.arquillian.daemon.server.Server.executeTest(Server.java:255)
at org.wildfly.swarm.arquillian.daemon@2.4.0.Final//org.wildfly.swarm.arquillian.daemon.server.Server$StringCommandHandler.channelRead0(Server.java:366)
at org.wildfly.swarm.arquillian.daemon@2.4.0.Final//org.wildfly.swarm.arquillian.daemon.server.Server$StringCommandHandler.channelRead0(Server.java:308)
at io.netty@4.1.25.Final//io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at io.netty@4.1.25.Final//io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty@4.1.25.Final//io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty@4.1.25.Final//io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty@4.1.25.Final//io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at io.netty@4.1.25.Final//io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty@4.1.25.Final//io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty@4.1.25.Final//io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty@4.1.25.Final//io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
at io.netty@4.1.25.Final//io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
at io.netty@4.1.25.Final//io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty@4.1.25.Final//io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty@4.1.25.Final//io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty@4.1.25.Final//io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
at io.netty@4.1.25.Final//io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty@4.1.25.Final//io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty@4.1.25.Final//io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
at io.netty@4.1.25.Final//io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty@4.1.25.Final//io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:647)
at io.netty@4.1.25.Final//io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:547)
at io.netty@4.1.25.Final//io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:501)
at io.netty@4.1.25.Final//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:461)
at io.netty@4.1.25.Final//io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
at io.netty@4.1.25.Final//io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:834)

Aucun commentaire:

Enregistrer un commentaire