Search in sources :

Example 6 with DeleteLanguageModelOptions

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

the class SpeechToTextTest method testDeleteLanguageModelWOptions.

// Test the deleteLanguageModel operation with a valid options model parameter
@Test
public void testDeleteLanguageModelWOptions() throws Throwable {
    // Register a mock response
    String mockResponseBody = "";
    String deleteLanguageModelPath = "/v1/customizations/testString";
    server.enqueue(new MockResponse().setResponseCode(200).setBody(mockResponseBody));
    // Construct an instance of the DeleteLanguageModelOptions model
    DeleteLanguageModelOptions deleteLanguageModelOptionsModel = new DeleteLanguageModelOptions.Builder().customizationId("testString").build();
    // Invoke deleteLanguageModel() with a valid options model and verify the result
    Response<Void> response = speechToTextService.deleteLanguageModel(deleteLanguageModelOptionsModel).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, deleteLanguageModelPath);
    // 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) DeleteLanguageModelOptions(com.ibm.watson.speech_to_text.v1.model.DeleteLanguageModelOptions) Test(org.testng.annotations.Test)

Aggregations

File (java.io.File)4 DeleteLanguageModelOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.DeleteLanguageModelOptions)3 DeleteLanguageModelOptions (com.ibm.watson.speech_to_text.v1.model.DeleteLanguageModelOptions)3 Test (org.junit.Test)3 AddCorpusOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.AddCorpusOptions)2 AddWordOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.AddWordOptions)2 Corpora (com.ibm.watson.developer_cloud.speech_to_text.v1.model.Corpora)2 CreateLanguageModelOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.CreateLanguageModelOptions)2 GetCorpusOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.GetCorpusOptions)2 LanguageModel (com.ibm.watson.developer_cloud.speech_to_text.v1.model.LanguageModel)2 ListCorporaOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.ListCorporaOptions)2 ListWordsOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.ListWordsOptions)2 Words (com.ibm.watson.developer_cloud.speech_to_text.v1.model.Words)2 AddCorpusOptions (com.ibm.watson.speech_to_text.v1.model.AddCorpusOptions)2 AddWordOptions (com.ibm.watson.speech_to_text.v1.model.AddWordOptions)2 Corpora (com.ibm.watson.speech_to_text.v1.model.Corpora)2 CreateLanguageModelOptions (com.ibm.watson.speech_to_text.v1.model.CreateLanguageModelOptions)2 GetCorpusOptions (com.ibm.watson.speech_to_text.v1.model.GetCorpusOptions)2 LanguageModel (com.ibm.watson.speech_to_text.v1.model.LanguageModel)2 ListCorporaOptions (com.ibm.watson.speech_to_text.v1.model.ListCorporaOptions)2