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);
}
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);
}
Aggregations