you can use light shine , it mocks the EJB injection system.
Another way is to set the field using reflection in your tests, I will someday use something like this:
public static void setPrivateField(Class<? extends Object> instanceFieldClass, Object instance, String fieldName, Object fieldValue) throws Exception {
Field setId = instanceFieldClass.getDeclaredField(fieldName);
setId.setAccessible(true);
setId.set(instance, fieldValue);
}
source
share