creating FieldEntry for unit tests

I'm using EMA Java 3.6.5.0 and I would like to write some unit tests. I see elsewhere descriptions on how to use replayers or mock providers, which are really more like integration tests, but I am wanting to write some simple unit tests that run with junit at compile time and do not require spinning up a separate process, so I want to create a FieldEntry and pass it to my methods. I tried the following

FieldEntry field = EmaFactory.createFieldEntry().real(1234, 999, OmmReal.MagnitudeType.EXPONENT_NEG_2);
System.out.println(field.toString());
System.out.println("id="+field.fieldId());
System.out.println("load="+field.load());
System.out.println("code="+field.code());

FieldEntry field = EmaFactory.createFieldEntry().codeReal(5678);
System.out.println(field.toString());
System.out.println("id="+field.fieldId());
System.out.println("load="+field.load());
System.out.println("code="+field.code());

But load() is null and code() throws NullPointerException and toString() returns "Decoding of just encoded object in the same application is not supported".

How can I do this?

Best Answer

Answers