use of com.ibm.watson.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());
}
use of com.ibm.watson.natural_language_classifier.v1.model.ClassifierList in project java-sdk by watson-developer-cloud.
the class NaturalLanguageClassifierTest method testListClassifiersWOptions.
@Test
public void testListClassifiersWOptions() throws Throwable {
// Schedule some responses.
String mockResponseBody = "{\"classifiers\": [{\"name\": \"name\", \"url\": \"url\", \"status\": \"Non Existent\", \"classifier_id\": \"classifierId\", \"created\": \"2019-01-01T12:00:00.000Z\", \"status_description\": \"statusDescription\", \"language\": \"language\"}]}";
String listClassifiersPath = "/v1/classifiers";
server.enqueue(new MockResponse().setHeader("Content-type", "application/json").setResponseCode(200).setBody(mockResponseBody));
constructClientService();
// Construct an instance of the ListClassifiersOptions model
ListClassifiersOptions listClassifiersOptionsModel = new ListClassifiersOptions();
// Invoke operation with valid options model (positive test)
Response<ClassifierList> response = naturalLanguageClassifierService.listClassifiers(listClassifiersOptionsModel).execute();
assertNotNull(response);
ClassifierList responseObj = response.getResult();
assertNotNull(responseObj);
// Verify the contents of the request
RecordedRequest request = server.takeRequest();
assertNotNull(request);
assertEquals(request.getMethod(), "GET");
// Check query
Map<String, String> query = TestUtilities.parseQueryString(request);
assertNull(query);
// Check request path
String parsedPath = TestUtilities.parseReqPath(request);
assertEquals(parsedPath, listClassifiersPath);
}
use of com.ibm.watson.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();
final ClassifierList classifiers = service.listClassifiers(listOptions).execute().getResult();
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());
}
use of com.ibm.watson.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));
}
use of com.ibm.watson.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);
}
Aggregations