Search in sources :

Example 1 with HeadDesignDocumentOptions

use of com.ibm.cloud.cloudant.v1.model.HeadDesignDocumentOptions in project cloudant-java-sdk by IBM.

the class CloudantTest method testHeadDesignDocumentWOptions.

@Test
public void testHeadDesignDocumentWOptions() throws Throwable {
    // Schedule some responses.
    String mockResponseBody = "";
    String headDesignDocumentPath = "/testString/_design/testString";
    server.enqueue(new MockResponse().setResponseCode(200).setBody(mockResponseBody));
    constructClientService();
    // Construct an instance of the HeadDesignDocumentOptions model
    HeadDesignDocumentOptions headDesignDocumentOptionsModel = new HeadDesignDocumentOptions.Builder().db("testString").ddoc("testString").ifNoneMatch("testString").build();
    // Invoke operation with valid options model (positive test)
    Response<Void> response = cloudantService.headDesignDocument(headDesignDocumentOptionsModel).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(), "HEAD");
    // Check query
    Map<String, String> query = TestUtilities.parseQueryString(request);
    assertNull(query);
    // Check request path
    String parsedPath = TestUtilities.parseReqPath(request);
    assertEquals(parsedPath, headDesignDocumentPath);
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) MockResponse(okhttp3.mockwebserver.MockResponse) HeadDesignDocumentOptions(com.ibm.cloud.cloudant.v1.model.HeadDesignDocumentOptions) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with HeadDesignDocumentOptions

use of com.ibm.cloud.cloudant.v1.model.HeadDesignDocumentOptions in project cloudant-java-sdk by IBM.

the class HeadDesignDocumentOptionsTest method testHeadDesignDocumentOptions.

@Test
public void testHeadDesignDocumentOptions() throws Throwable {
    HeadDesignDocumentOptions headDesignDocumentOptionsModel = new HeadDesignDocumentOptions.Builder().db("testString").ddoc("testString").ifNoneMatch("testString").build();
    assertEquals(headDesignDocumentOptionsModel.db(), "testString");
    assertEquals(headDesignDocumentOptionsModel.ddoc(), "testString");
    assertEquals(headDesignDocumentOptionsModel.ifNoneMatch(), "testString");
}
Also used : HeadDesignDocumentOptions(com.ibm.cloud.cloudant.v1.model.HeadDesignDocumentOptions) Test(org.testng.annotations.Test)

Aggregations

HeadDesignDocumentOptions (com.ibm.cloud.cloudant.v1.model.HeadDesignDocumentOptions)2 Test (org.testng.annotations.Test)2 MockResponse (okhttp3.mockwebserver.MockResponse)1 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1