How can I write a JUnit test to invoke a JNI that fails?

I am working on fixing a JNI call that is currently crashing. Aiming to be a good TDD practitioner, I created a JUnit test to reproduce the problem, which makes it excellent.

However, failure, the JNI call never returns. Can I write a JUnit test that reports an error when a JNI crashes?

+3
source share
2 answers

Oh, if your JNI is crashing into the JVM, then of course it will be difficult to check from junit. For example, you cannot connect a signal handler for SIGSEGV, the JVM will just die.

, Java- Main, , junit Java, - Runtime # exec.

- , .

+3

All Articles