use of com.ibm.watson.developer_cloud.natural_language_understanding.v1.model.ConceptsOptions in project java-sdk by watson-developer-cloud.
the class NaturalLanguageUnderstandingTest method testAnalyze.
/**
* Test analyze.
*
* @throws InterruptedException the interrupted exception
* @throws FileNotFoundException
*/
@Test
public void testAnalyze() throws InterruptedException, FileNotFoundException {
String testHtmlFileName = RESOURCE + "testArticle.html";
String html = getStringFromInputStream(new FileInputStream(testHtmlFileName));
ConceptsOptions concepts = new ConceptsOptions.Builder().limit(5).build();
assertEquals(concepts.limit(), 5, 0);
concepts.newBuilder();
Features features = new Features.Builder().concepts(concepts).build();
AnalyzeOptions parameters = new AnalyzeOptions.Builder().html(html).features(features).build();
server.enqueue(jsonResponse(analyzeResults));
final AnalysisResults response = service.analyze(parameters).execute();
final RecordedRequest request = server.takeRequest();
assertEquals(ANALYZE_PATH, request.getPath());
assertEquals("POST", request.getMethod());
assertEquals(analyzeResults, response);
}
Aggregations