Skip to content

Commit 41d73c7

Browse files
Fixing TranscriptionsAPITest
1 parent 249afe5 commit 41d73c7

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/test/java/com/bandwidth/sdk/api/TranscriptionsApiTest.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ public class TranscriptionsApiTest {
6868
private static UpdateCall completeMantecaCallBody = new UpdateCall();
6969
private static URI mantecaAnswerUrl;
7070
private static String bxmlBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Bxml><SpeakSentence locale=\"en_US\" gender=\"female\" voice=\"susan\">This is a bxml start transcription test.</SpeakSentence><StartTranscription tracks=\"both\"></StartTranscription><SpeakSentence voice=\"bridget\">Ideally this part is being transcribed.</SpeakSentence><Pause duration=\"3\"/></Bxml>";
71-
private static int TEST_SLEEP = 60;
71+
private static int TEST_SLEEP = 10;
72+
private static int TEST_SLEEP_LONG = 60;
7273

7374

7475
@Test
@@ -85,15 +86,15 @@ public void getAndDeleteRealTimeTranscriptionsTest() throws ApiException, Interr
8586

8687

8788
// This is just creating the call, modifying with StartTranscript, and ending it so we can test the transcription below.
88-
TimeUnit.SECONDS.sleep(TEST_SLEEP);
8989
ApiResponse<CreateCallResponse> createCallResponse = callsApi.createCallWithHttpInfo(BW_ACCOUNT_ID, createMantecaCallBody);
9090

9191

9292
String callId = createCallResponse.getData().getCallId();
9393
assertThat(createCallResponse.getStatusCode(), is(201));
9494

95-
// Redirect call to different url
95+
9696
TimeUnit.SECONDS.sleep(TEST_SLEEP);
97+
// Redirect call to different url
9798
ApiResponse<Void> updateCallResponse = callsApi.updateCallBxmlWithHttpInfo(BW_ACCOUNT_ID, callId, bxmlBody);
9899

99100
assertThat(updateCallResponse.getStatusCode(), is(204));
@@ -105,21 +106,23 @@ public void getAndDeleteRealTimeTranscriptionsTest() throws ApiException, Interr
105106

106107
assertThat(completeCallResponse.getStatusCode(), is(200));
107108

109+
110+
TimeUnit.SECONDS.sleep(TEST_SLEEP_LONG);
108111
// The Transcriptions API tests start here
109112
ApiResponse<List<CallTranscriptionMetadata>> listRealTimeTranscriptionResponse = transcriptionsApi.listRealTimeTranscriptionsWithHttpInfo(BW_ACCOUNT_ID, createCallResponse.getData().getCallId());
110113

111-
String transcriptionId = listRealTimeTranscriptionResponse.getData().toString();
114+
String transcriptionId = listRealTimeTranscriptionResponse.getData().get(0).getTranscriptionId();
112115
TimeUnit.SECONDS.sleep(TEST_SLEEP);
113116

114117
ApiResponse<CallTranscriptionResponse> getRealTimeTranscriptionResponse = transcriptionsApi.getRealTimeTranscriptionWithHttpInfo(BW_ACCOUNT_ID, callId, transcriptionId);
115118

116119
assertThat(getRealTimeTranscriptionResponse.getStatusCode(), is(200));
117-
assertThat(getRealTimeTranscriptionResponse.getData(), hasProperty("transcriptId", is(instanceOf(String.class))));
120+
assertThat(getRealTimeTranscriptionResponse.getData(), hasProperty("transcriptionId", is(instanceOf(String.class))));
118121

119122

120123
ApiResponse<Void> deleteRealTimeTranscriptionResponse = transcriptionsApi.deleteRealTimeTranscriptionWithHttpInfo(BW_ACCOUNT_ID, createCallResponse.getData().getCallId(), transcriptionId);
121124

122-
assertThat(deleteRealTimeTranscriptionResponse.getStatusCode(), is(204));
125+
assertThat(deleteRealTimeTranscriptionResponse.getStatusCode(), is(200));
123126

124127
}
125128
}

0 commit comments

Comments
 (0)