JUnit test failing with NPE while using Variables objectValue method to store large value in execution context
execution.setVariable("variable", Variables.serializedObjectValue(getMessage(messageString)).create());
tried differently
execution.setVariable("variable", Variables.objectValue(getMessage(messageString()))
.serializationDataFormat(Variables.SerializationDataFormats.JAVA).create());
as far as I can see there are 2 issues:
- not able to mock the Variables class
- not able to workaround the mocking of Variable class
error stack trace for the location of invocation:
Caused by: java.lang.NullPointerException
at org.camunda.bpm.engine.impl.core.variable.VariableUtil.checkJavaSerialization(VariableUtil.java:47)
at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.setVariableLocal(AbstractVariableScope.java:308)
at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.setVariable(AbstractVariableScope.java:303)
at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.setVariable(AbstractVariableScope.java:284)
how can I mock the Variables object in my Junit or can I have a workaround if not possible to mock the variable class