Search in sources :

Example 1 with DeleteEnrichmentOptions

use of com.ibm.watson.discovery.v2.model.DeleteEnrichmentOptions in project java-sdk by watson-developer-cloud.

the class DiscoveryTest method testDeleteEnrichmentWOptions.

@Test
public void testDeleteEnrichmentWOptions() throws Throwable {
    // Schedule some responses.
    String mockResponseBody = "";
    String deleteEnrichmentPath = "/v2/projects/testString/enrichments/testString";
    server.enqueue(new MockResponse().setResponseCode(204).setBody(mockResponseBody));
    constructClientService();
    // Construct an instance of the DeleteEnrichmentOptions model
    DeleteEnrichmentOptions deleteEnrichmentOptionsModel = new DeleteEnrichmentOptions.Builder().projectId("testString").enrichmentId("testString").build();
    // Invoke operation with valid options model (positive test)
    Response<Void> response = discoveryService.deleteEnrichment(deleteEnrichmentOptionsModel).execute();
    assertNotNull(response);
    Void responseObj = response.getResult();
    // Response does not have a return type. Check that the result is null.
    assertNull(responseObj);
    // Verify the contents of the request
    RecordedRequest request = server.takeRequest();
    assertNotNull(request);
    assertEquals(request.getMethod(), "DELETE");
    // Check query
    Map<String, String> query = TestUtilities.parseQueryString(request);
    assertNotNull(query);
    // Get query params
    assertEquals(query.get("version"), "testString");
    // Check request path
    String parsedPath = TestUtilities.parseReqPath(request);
    assertEquals(parsedPath, deleteEnrichmentPath);
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) MockResponse(okhttp3.mockwebserver.MockResponse) DeleteEnrichmentOptions(com.ibm.watson.discovery.v2.model.DeleteEnrichmentOptions) Test(org.testng.annotations.Test)

Aggregations

DeleteEnrichmentOptions (com.ibm.watson.discovery.v2.model.DeleteEnrichmentOptions)1 MockResponse (okhttp3.mockwebserver.MockResponse)1 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)1 Test (org.testng.annotations.Test)1