use of com.ibm.cloud.sdk.core.service.exception.NotFoundException in project java-sdk by watson-developer-cloud.
the class NaturalLanguageClassifierIT method fClassifyCollection.
/**
* Test classifyCollection. Use the pre created classifier to avoid waiting for availability
*/
@Test
public void fClassifyCollection() {
ClassificationCollection classificationCollection = null;
ClassifyInput input1 = new ClassifyInput.Builder().text("How hot will it be today?").build();
ClassifyInput input2 = new ClassifyInput.Builder().text("Is it hot outside?").build();
try {
ClassifyCollectionOptions classifyOptions = new ClassifyCollectionOptions.Builder().classifierId(preCreatedClassifierId).addClassifyInput(input1).addClassifyInput(input2).build();
classificationCollection = service.classifyCollection(classifyOptions).execute().getResult();
} catch (NotFoundException e) {
// The build should not fail here, because this is out of our control.
throw new AssumptionViolatedException(e.getMessage(), e);
}
assertNotNull(classificationCollection);
assertEquals("temperature", classificationCollection.getCollection().get(0).getTopClass());
assertEquals("temperature", classificationCollection.getCollection().get(1).getTopClass());
}
Aggregations