title: How to unit test a library that uses JNI?
body: <p>Unit testing best practices call for the use of inversion of control to ensure that unit tests run independently of each other even if they depend on singleton instances (each test gets their own "singleton").</p>
  
  <p>What is the recommendation for testing a library that uses JNI to manipulate a native resource that only exists once per Process (e.g. the terminal)?</p>
  
  <p>I'm not asking about testing the actual JNI code but rather the Java code that depends on the native code as a side-effect.</p>