Test coverage on non-java code

I am curious on what code can not be unit tested from a Java-Application. I got an Application running with several Java-delegates and have written unit tests for those. I assume that for script-tasks there is no way of unit testing those. I wondered if there is more that can not be unit tested from a Java-Application like Expressions, Connectors or External code in Service tasks?

Take a look at Camunda-Spock-Testing/EndToEndNashornSpec.groovy at master · DigitalState/Camunda-Spock-Testing · GitHub

This is a example of testing your js scripts.

You can parse the BPMN and then get the configuration or other configs such as expressions, connectors, etc. But generally it can be easier to just use a process test and use the runtime services modification API to modify/move your process to the exact point you want to test (such as right before an expression).

I dont quite understand this approach. So is there a way to Unit test Script tasks from JUnit Tests?
If I get right what you are saying you can parse the javascript text from the bpmn file and test this code?

The unit test generates a js script engine based on the Camunda’s script engine configuration. You can provide a script directly or you can parse the BPMN and extract the script and inject it into the script engine for evaluation. When Camunda executes a BPMN and reaches a point where there is a script it uses a script engine to eval that code. My example creates the same structure but in a unit test so you can independently test your scripts outside of an actual engine context.

My example is based on Spock. But you can take the same core code and flip it into pure junit