Source:
public void testPartialHangupScenario() throws Exception { new JavaTestKit(system) { { final ActorRef observer = getRef(); final ActorRef interpreter = createVoiceInterpreter(observer); interpreter.tell(new StartInterpreter(observer), observer); expectMsgClass(GetCallInfo.class); interpreter.tell(new CallResponse(new CallInfo( new Sid("ACae6e420f425248d6a26948c17a9e2acf"), CallStateChanged.State.IN_PROGRESS, CreateCallType.SIP, "inbound", new DateTime(), null, "test", "test", "testTo", null, null, false, false, false, new DateTime())), observer); expectMsgClass(Observe.class); HttpRequestDescriptor callback = expectMsgClass(HttpRequestDescriptor.class); assertEquals(callback.getUri(), requestUri); interpreter.tell(new DownloaderResponse(getOkRcml(requestUri, gatherRcml)), observer); expectMsgClass(Collect.class); interpreter.tell(new MediaGroupResponse(new CollectedResult("1", true, true)), observer); callback = expectMsgClass(HttpRequestDescriptor.class); assertEquals(callback.getUri(), partialCallbackUri); assertEquals(findParam(callback.getParameters(), "UnstableSpeechResult").getValue(), "1"); interpreter.tell(new DownloaderResponse(getOkRcml(partialCallbackUri, "")), observer); interpreter.tell(new MediaGroupResponse(new CollectedResult("12", true, true)), observer); callback = expectMsgClass(HttpRequestDescriptor.class); assertEquals(callback.getUri(), partialCallbackUri); assertEquals(findParam(callback.getParameters(), "UnstableSpeechResult").getValue(), "12"); interpreter.tell(new MediaGroupResponse(new CollectedResult("Hello. World.", true, false)), observer); callback = expectMsgClass(HttpRequestDescriptor.class); assertEquals(callback.getUri(), actionCallbackUri); assertEquals(findParam(callback.getParameters(), "SpeechResult").getValue(), "Hello. World."); interpreter.tell(new DownloaderResponse(getOkRcml(partialCallbackUri, endRcml)), observer); expectMsgClass(Hangup.class); } }; }

Target:
public void testPartialHangupScenario() throws Exception { new JavaTestKit(system) { { final ActorRef observer = getRef(); final ActorRef interpreter = createVoiceInterpreter(observer); interpreter.tell(new StartInterpreter(observer), observer); expectMsgClass(GetCallInfo.class); interpreter.tell(new CallResponse(new CallInfo( new Sid("ACae6e420f425248d6a26948c17a9e2acf"), CallStateChanged.State.IN_PROGRESS, CreateCallType.SIP, "inbound", new DateTime(), null, "test", "test", "testTo", null, null, false, false, false, new DateTime())), observer); expectMsgClass(Observe.class); HttpRequestDescriptor callback = expectMsgClass(HttpRequestDescriptor.class); assertEquals(callback.getUri(), requestUri); interpreter.tell(new DownloaderResponse(getOkRcml(requestUri, gatherRcmlPartial)), observer); expectMsgClass(Collect.class); interpreter.tell(new MediaGroupResponse(new CollectedResult("1", true, true)), observer); callback = expectMsgClass(HttpRequestDescriptor.class); assertEquals(callback.getUri(), partialCallbackUri); assertEquals(findParam(callback.getParameters(), "UnstableSpeechResult").getValue(), "1"); interpreter.tell(new DownloaderResponse(getOkRcml(partialCallbackUri, "")), observer); interpreter.tell(new MediaGroupResponse(new CollectedResult("12", true, true)), observer); callback = expectMsgClass(HttpRequestDescriptor.class); assertEquals(callback.getUri(), partialCallbackUri); assertEquals(findParam(callback.getParameters(), "UnstableSpeechResult").getValue(), "12"); interpreter.tell(new MediaGroupResponse(new CollectedResult("Hello. World.", true, false)), observer); callback = expectMsgClass(HttpRequestDescriptor.class); assertEquals(callback.getUri(), actionCallbackUri); assertEquals(findParam(callback.getParameters(), "SpeechResult").getValue(), "Hello. World."); interpreter.tell(new DownloaderResponse(getOkRcml(actionCallbackUri, endRcml)), observer); expectMsgClass(Hangup.class); } }; }