Throwing Exceptions from Mocks

When trying to throw an IOException from a mock, I get the following message:

Exception in thread "main" java.lang.UnsatisfiedLinkError: HIL client execution exception: 

The implementation works fine in hardware using the function:

 SNI_throwNativeIOException

The mock prototype includes the

throws IOException

Is there some trick to throwing IOExceptions from mocks?

Thanks,

Steve

Hi @ssampson

On mockup side, you have to throw one of the dedicated exceptions:

  • ej.sni.NativeException which is SNI_throwNativeException counterpart
  • ej.sni.NativeIOException which is SNI_throwNativeIOException counterpart

These classes are part of the new HIL Engine API provided by MicroEJ SDK 19.02 (microej-mock skeleton).
If you are using an older version (until MicroEJ SDK 4.1.5), you can simply replace the HILEngine.jar file of your mockup project by this one: HILEngine.jar (11.0 KB)

Here is the expected filesystem structure:
microej-mock-hilengine-location

Best regards,
–Frédéric

Frederic,

That is exactly what I was looking for. Thank you.

Steve