use of com.ibm.cloud.cloudant.v1.model.Analyzer in project cloudant-java-sdk by IBM.
the class CloudantTest method testPostSearchAnalyzeWOptions.
@Test
public void testPostSearchAnalyzeWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"tokens\": [\"tokens\"]}";
String postSearchAnalyzePath = "/_search_analyze";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the PostSearchAnalyzeOptions model
PostSearchAnalyzeOptions postSearchAnalyzeOptionsModel = new PostSearchAnalyzeOptions.Builder().analyzer("arabic").text("testString").build();
// Invoke operation with valid options model (positive test)
Response<SearchAnalyzeResult> response = cloudantService.postSearchAnalyze(postSearchAnalyzeOptionsModel).execute();
assertNotNull(response);
SearchAnalyzeResult responseObj = response.getResult();
assertNotNull(responseObj);
// Verify the contents of the request
RecordedRequest request = server.takeRequest();
assertNotNull(request);
assertEquals(request.getMethod(), "POST");
// Check query
Map<String, String> query = TestUtilities.parseQueryString(request);
assertNull(query);
// Check request path
String parsedPath = TestUtilities.parseReqPath(request);
assertEquals(parsedPath, postSearchAnalyzePath);
}
Aggregations