Search in sources :

Example 1 with ClassifierList

use of com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ClassifierList in project java-sdk by watson-developer-cloud.

the class NaturalLanguageClassifierIT method cListClassifiers.

/**
 * Test list classifiers.
 */
@Test
public void cListClassifiers() {
    ListClassifiersOptions listOptions = new ListClassifiersOptions.Builder().build();
    final ClassifierList classifiers = service.listClassifiers(listOptions).execute();
    assertNotNull(classifiers);
    // #324: Classifiers may be empty, because of other tests interfering.
    // The build should not fail here, because this is out of our control.
    Assume.assumeFalse(classifiers.getClassifiers().isEmpty());
}
Also used : ClassifierList(com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ClassifierList) ListClassifiersOptions(com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ListClassifiersOptions) Test(org.junit.Test) WatsonServiceTest(com.ibm.watson.developer_cloud.WatsonServiceTest)

Example 2 with ClassifierList

use of com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ClassifierList in project java-sdk by watson-developer-cloud.

the class NaturalLanguageClassifier method listClassifiers.

/**
 * List classifiers.
 *
 * Returns an empty array if no classifiers are available.
 *
 * @param listClassifiersOptions the {@link ListClassifiersOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link ClassifierList}
 */
public ServiceCall<ClassifierList> listClassifiers(ListClassifiersOptions listClassifiersOptions) {
    String[] pathSegments = { "v1/classifiers" };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
    if (listClassifiersOptions != null) {
    }
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ClassifierList.class));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) ClassifierList(com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ClassifierList)

Example 3 with ClassifierList

use of com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ClassifierList in project java-sdk by watson-developer-cloud.

the class NaturalLanguageClassifierTest method testGetClassifiers.

/**
 * Test get classifiers.
 *
 * @throws InterruptedException the interrupted exception
 */
@Test
public void testGetClassifiers() throws InterruptedException {
    server.enqueue(jsonResponse(classifiers));
    final ClassifierList response = service.listClassifiers().execute();
    final RecordedRequest request = server.takeRequest();
    assertEquals(CLASSIFIERS_PATH, request.getPath());
    assertEquals(classifiers, response);
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) ClassifierList(com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ClassifierList) Test(org.junit.Test) WatsonServiceUnitTest(com.ibm.watson.developer_cloud.WatsonServiceUnitTest)

Aggregations

ClassifierList (com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ClassifierList)3 Test (org.junit.Test)2 WatsonServiceTest (com.ibm.watson.developer_cloud.WatsonServiceTest)1 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)1 RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)1 ListClassifiersOptions (com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ListClassifiersOptions)1 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)1