I’m writing tests for my app and one of them has to check if my service throws an exception,
assertThrows(expected, given);
but platform wraps my given exception into RemoteException so it never matches the expected.
org.opentest4j.AssertionFailedError: Unexpected exception type thrown ==> expected: <com.company.app.service.ParameterRecognitionException> but was: <com.haulmont.cuba.core.global.RemoteException>
at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:65)
at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:37)
at org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:2952)
at com.company.app.core.MyServiceTest.checkNull(MyServiceTest.java:49)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
....
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.haulmont.cuba.core.global.RemoteException:
---
com.company.app.service.ParameterRecognitionException: BLOCK_NULL
should i unwrap it somehow like (pseudocode follows)