use of com.ibm.watson.developer_cloud.text_to_speech.v1.model.ListWordsOptions in project java-sdk by watson-developer-cloud.
the class SpeechToTextIT method testGetWordsThreeTypeSort.
/**
* Test list words with type all and count sort.
*/
@Test
@Ignore
public void testGetWordsThreeTypeSort() {
ListWordsOptions listOptions = new ListWordsOptions.Builder().customizationId(customizationId).wordType(ListWordsOptions.WordType.ALL).sort(ListWordsOptions.Sort.COUNT).build();
Words result = service.listWords(listOptions).execute();
assertNotNull(result);
assertTrue(!result.getWords().isEmpty());
}
use of com.ibm.watson.developer_cloud.text_to_speech.v1.model.ListWordsOptions in project java-sdk by watson-developer-cloud.
the class SpeechToTextIT method testGetWordsThreeSort.
/**
* Test list words with alphabetical sort.
*/
@Test
@Ignore
public void testGetWordsThreeSort() {
ListWordsOptions listOptions = new ListWordsOptions.Builder().customizationId(customizationId).sort(ListWordsOptions.Sort.ALPHABETICAL).build();
Words result = service.listWords(listOptions).execute();
assertNotNull(result);
assertTrue(!result.getWords().isEmpty());
}
use of com.ibm.watson.developer_cloud.text_to_speech.v1.model.ListWordsOptions in project java-sdk by watson-developer-cloud.
the class SpeechToTextIT method testListWordsCustomizationId.
/**
* Test list words with just a customization ID.
*/
@Test
@Ignore
public void testListWordsCustomizationId() {
ListWordsOptions listOptions = new ListWordsOptions.Builder().customizationId(customizationId).build();
Words result = service.listWords(listOptions).execute();
assertNotNull(result);
assertTrue(!result.getWords().isEmpty());
}
use of com.ibm.watson.developer_cloud.text_to_speech.v1.model.ListWordsOptions in project java-sdk by watson-developer-cloud.
the class SpeechToTextTest method testListWords.
/**
* Test list words.
*
* @throws InterruptedException the interrupted exception
* @throws FileNotFoundException the file not found exception
*/
@Test
public void testListWords() throws InterruptedException, FileNotFoundException {
String id = "foo";
String wordsAsStr = getStringFromInputStream(new FileInputStream("src/test/resources/speech_to_text/words.json"));
JsonObject words = new JsonParser().parse(wordsAsStr).getAsJsonObject();
server.enqueue(new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody(wordsAsStr));
ListWordsOptions listOptions = new ListWordsOptions.Builder().customizationId(id).build();
Words result = service.listWords(listOptions).execute();
final RecordedRequest request = server.takeRequest();
assertEquals("GET", request.getMethod());
assertEquals(String.format(PATH_WORDS, id), request.getPath());
assertEquals(words.get("words"), GSON.toJsonTree(result.getWords()));
}
use of com.ibm.watson.developer_cloud.text_to_speech.v1.model.ListWordsOptions in project java-sdk by watson-developer-cloud.
the class SpeechToTextTest method testListWordsSort.
/**
* Test list words with sort order alphabetical.
*
* @throws InterruptedException the interrupted exception
* @throws FileNotFoundException the file not found exception
*/
@Test
public void testListWordsSort() throws InterruptedException, FileNotFoundException {
String id = "foo";
String wordsAsStr = getStringFromInputStream(new FileInputStream("src/test/resources/speech_to_text/words.json"));
JsonObject words = new JsonParser().parse(wordsAsStr).getAsJsonObject();
server.enqueue(new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody(wordsAsStr));
ListWordsOptions listOptions = new ListWordsOptions.Builder().customizationId(id).sort(ListWordsOptions.Sort.ALPHABETICAL).build();
Words result = service.listWords(listOptions).execute();
final RecordedRequest request = server.takeRequest();
assertEquals("GET", request.getMethod());
assertEquals(String.format(PATH_WORDS, id) + "?sort=alphabetical", request.getPath());
assertEquals(words.get("words"), GSON.toJsonTree(result.getWords()));
}
Aggregations