use of com.ibm.watson.speech_to_text.v1.model.DeleteCorpusOptions in project java-sdk by watson-developer-cloud.
the class SpeechToTextTest method testDeleteCorpusWOptions.
// Test the deleteCorpus operation with a valid options model parameter
@Test
public void testDeleteCorpusWOptions() throws Throwable {
// Register a mock response
String mockResponseBody = "";
String deleteCorpusPath = "/v1/customizations/testString/corpora/testString";
server.enqueue(new MockResponse().setResponseCode(200).setBody(mockResponseBody));
// Construct an instance of the DeleteCorpusOptions model
DeleteCorpusOptions deleteCorpusOptionsModel = new DeleteCorpusOptions.Builder().customizationId("testString").corpusName("testString").build();
// Invoke deleteCorpus() with a valid options model and verify the result
Response<Void> response = speechToTextService.deleteCorpus(deleteCorpusOptionsModel).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, deleteCorpusPath);
// Verify that there is no query string
Map<String, String> query = TestUtilities.parseQueryString(request);
assertNull(query);
}
use of com.ibm.watson.speech_to_text.v1.model.DeleteCorpusOptions in project java-sdk by watson-developer-cloud.
the class SpeechToTextTest method testDeleteCorpus.
/**
* Test delete corpus.
*
* @throws InterruptedException the interrupted exception
* @throws FileNotFoundException the file not found exception
*/
@Test
public void testDeleteCorpus() throws InterruptedException, FileNotFoundException {
String id = "foo";
String corpus = "cName";
server.enqueue(new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody("{}"));
DeleteCorpusOptions deleteOptions = new DeleteCorpusOptions.Builder().customizationId(id).corpusName(corpus).build();
service.deleteCorpus(deleteOptions).execute();
final RecordedRequest request = server.takeRequest();
assertEquals("DELETE", request.getMethod());
assertEquals(String.format(PATH_CORPUS, id, corpus), request.getPath());
}
Aggregations