Thank you so much for your help Esteban Aliverti.
I tried to to create EndEvent in the ad-hoc process and link it to the ScriptTask as your suggestion but it did not return back to the EndEvent in the Process too. However, I found the intersting thing at the testAdHocSubProcessAutoComplete(). The "completionCondition" property of ad-hoc process was set as <completionCondition xsi:type="tFormalExpression">getActivityInstanceAttribute("numberOfActiveInstances") == 0</completionCondition> in the resource file of the test. When I set the property in my resource file like that, JBPM will return back to the EndEvent in the Process after triggering the ScriptTask.