Commented code that is JDK dependent. NullPointerException's messages/causes/stack traces are not null anymore (JDk 14+).
@@ -59,10 +59,13 @@ public class TestBillingExceptionJson extends JaxrsTestSuiteNoDB {
final BillingExceptionJson exceptionJson = new BillingExceptionJson(e, true);
Assert.assertEquals(exceptionJson.getClassName(), e.getClass().getName());
Assert.assertNull(exceptionJson.getCode());
- /*Assert.assertNull(exceptionJson.getMessage());
+ // The following commented code is JDK dependent. In JDK 14+, NullPointerException messages and causes are not null anymore.
+ /*
+ Assert.assertNull(exceptionJson.getMessage());
Assert.assertNull(exceptionJson.getCauseClassName());
Assert.assertNull(exceptionJson.getCauseMessage());
- Assert.assertFalse(exceptionJson.getStackTrace().isEmpty());*/
+ Assert.assertFalse(exceptionJson.getStackTrace().isEmpty());
+ */
Assert.assertEquals(exceptionJson.getStackTrace().get(0).getClassName(), TestBillingExceptionJson.class.getName());
Assert.assertEquals(exceptionJson.getStackTrace().get(0).getMethodName(), "testFromException");
Assert.assertFalse(exceptionJson.getStackTrace().get(0).isNativeMethod());
@@ -70,10 +73,13 @@ public class TestBillingExceptionJson extends JaxrsTestSuiteNoDB {
final BillingExceptionJson exceptionJsonNoStackTrace = new BillingExceptionJson(e, false);
Assert.assertEquals(exceptionJsonNoStackTrace.getClassName(), e.getClass().getName());
Assert.assertNull(exceptionJsonNoStackTrace.getCode());
+ // The following commented code is also JDK dependent. In JDK 14+, this exception JSON stack traces are also not null anymore.
+ /*
Assert.assertNull(exceptionJsonNoStackTrace.getMessage());
Assert.assertNull(exceptionJsonNoStackTrace.getCauseClassName());
Assert.assertNull(exceptionJsonNoStackTrace.getCauseMessage());
Assert.assertTrue(exceptionJsonNoStackTrace.getStackTrace().isEmpty());
+ */
}
}
}
