Error in running Java code in Camunda

Hello all,
I’m new in Camunda, I am following the below video to add java code in a service task in Camunda process.

Tutorial: Camunda Enterprise Edition for Java Developers (Video 2) - YouTube

When I run the project , I get the below error:
Tests in error:
testHappyPath(com.camunda.demo.simpleDemo.ProcessUnitTest): Unknown property used in expression: #{weatherOK}. Cause: Cannot resolve identifier ‘weatherOK’

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project simpleDemo: There are test failures.

Any suggestion of how to fix it?
Thanks in advance

Hey @Alaa_sy ,

the error message says that there is a problem with the expression #{weatherOK}. Is the variable weatherOK created in your test and has the value true? Make sure that the test has the information once it arrives at the point where the expression is evaluated.

I hope this helps
Cheers
Nele

1 Like

Thank you. the variable is set in the execute method :
@Override
public void execute(DelegateExecution execution) throws Exception {
// TODO Auto-generated method stub
Random rando=new Random();
execution.setVariable(“weatherOK”, rando.nextBoolean());
}

Hey @Alaa_sy ,

is it anyhow possible to share your project maybe on github? I think it makes it easier to check where the problem comes from.

Cheers
Nele