Search in sources :

Example 6 with DeleteWordOptions

use of com.ibm.watson.text_to_speech.v1.model.DeleteWordOptions in project java-sdk by watson-developer-cloud.

the class SpeechToTextTest method testDeleteWordWOptions.

// Test the deleteWord operation with a valid options model parameter
@Test
public void testDeleteWordWOptions() throws Throwable {
    // Register a mock response
    String mockResponseBody = "";
    String deleteWordPath = "/v1/customizations/testString/words/testString";
    server.enqueue(new MockResponse().setResponseCode(200).setBody(mockResponseBody));
    // Construct an instance of the DeleteWordOptions model
    DeleteWordOptions deleteWordOptionsModel = new DeleteWordOptions.Builder().customizationId("testString").wordName("testString").build();
    // Invoke deleteWord() with a valid options model and verify the result
    Response<Void> response = speechToTextService.deleteWord(deleteWordOptionsModel).execute();
    assertNotNull(response);
    Void responseObj = response.getResult();
    assertNull(responseObj);
    // Verify the contents of the request sent to the mock server
    RecordedRequest request = server.takeRequest();
    assertNotNull(request);
    assertEquals(request.getMethod(), "DELETE");
    // Verify request path
    String parsedPath = TestUtilities.parseReqPath(request);
    assertEquals(parsedPath, deleteWordPath);
    // Verify that there is no query string
    Map<String, String> query = TestUtilities.parseQueryString(request);
    assertNull(query);
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) MockResponse(okhttp3.mockwebserver.MockResponse) DeleteWordOptions(com.ibm.watson.speech_to_text.v1.model.DeleteWordOptions) Test(org.testng.annotations.Test)

Example 7 with DeleteWordOptions

use of com.ibm.watson.text_to_speech.v1.model.DeleteWordOptions in project java-sdk by watson-developer-cloud.

the class TextToSpeechTest method testDeleteWordWOptions.

// Test the deleteWord operation with a valid options model parameter
@Test
public void testDeleteWordWOptions() throws Throwable {
    // Register a mock response
    String mockResponseBody = "";
    String deleteWordPath = "/v1/customizations/testString/words/testString";
    server.enqueue(new MockResponse().setResponseCode(204).setBody(mockResponseBody));
    // Construct an instance of the DeleteWordOptions model
    DeleteWordOptions deleteWordOptionsModel = new DeleteWordOptions.Builder().customizationId("testString").word("testString").build();
    // Invoke deleteWord() with a valid options model and verify the result
    Response<Void> response = textToSpeechService.deleteWord(deleteWordOptionsModel).execute();
    assertNotNull(response);
    Void responseObj = response.getResult();
    assertNull(responseObj);
    // Verify the contents of the request sent to the mock server
    RecordedRequest request = server.takeRequest();
    assertNotNull(request);
    assertEquals(request.getMethod(), "DELETE");
    // Verify request path
    String parsedPath = TestUtilities.parseReqPath(request);
    assertEquals(parsedPath, deleteWordPath);
    // Verify that there is no query string
    Map<String, String> query = TestUtilities.parseQueryString(request);
    assertNull(query);
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) MockResponse(okhttp3.mockwebserver.MockResponse) DeleteWordOptions(com.ibm.watson.text_to_speech.v1.model.DeleteWordOptions) Test(org.testng.annotations.Test)

Aggregations

MockResponse (okhttp3.mockwebserver.MockResponse)4 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)4 DeleteWordOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.DeleteWordOptions)3 Test (org.junit.Test)3 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)2 AddWordOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordOptions)2 ListWordsOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.ListWordsOptions)2 Word (com.ibm.watson.developer_cloud.text_to_speech.v1.model.Word)2 Words (com.ibm.watson.developer_cloud.text_to_speech.v1.model.Words)2 DeleteWordOptions (com.ibm.watson.text_to_speech.v1.model.DeleteWordOptions)2 File (java.io.File)2 InputStream (java.io.InputStream)2 Test (org.testng.annotations.Test)2 Authenticator (com.ibm.cloud.sdk.core.security.Authenticator)1 IamAuthenticator (com.ibm.cloud.sdk.core.security.IamAuthenticator)1 WatsonServiceTest (com.ibm.watson.developer_cloud.WatsonServiceTest)1 DeleteWordOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.DeleteWordOptions)1 AddWordsOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordsOptions)1 CreateVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.CreateVoiceModelOptions)1 DeleteVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.DeleteVoiceModelOptions)1