use of com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetWordOptions in project java-sdk by watson-developer-cloud.
the class CustomizationsIT method testGetWordJapanese.
/**
* Test get word for Japanese.
*/
@Test
public void testGetWordJapanese() {
model = createVoiceModelJapanese();
final List<Word> expected = instantiateWordsJapanese();
AddWordsOptions addOptions = new AddWordsOptions.Builder().customizationId(model.getCustomizationId()).words(expected).build();
service.addWords(addOptions).execute();
GetWordOptions getOptions = new GetWordOptions.Builder().customizationId(model.getCustomizationId()).word(expected.get(0).getWord()).build();
final Translation translation = service.getWord(getOptions).execute();
assertEquals(expected.get(0).getTranslation(), translation.getTranslation());
assertEquals(expected.get(0).getPartOfSpeech(), translation.getPartOfSpeech());
}
use of com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetWordOptions in project java-sdk by watson-developer-cloud.
the class CustomizationsTest method testGetWord.
/**
* Test get word.
*
* @throws InterruptedException the interrupted exception
*/
@Test
public void testGetWord() throws InterruptedException {
final Word expected = instantiateWords().get(0);
server.enqueue(jsonResponse(ImmutableMap.of(TRANSLATION, expected.getTranslation())));
GetWordOptions getOptions = new GetWordOptions.Builder().customizationId(CUSTOMIZATION_ID).word(expected.getWord()).build();
final Translation result = service.getWord(getOptions).execute();
final RecordedRequest request = server.takeRequest();
assertEquals(String.format(WORDS_PATH, CUSTOMIZATION_ID) + "/" + expected.getWord(), request.getPath());
assertEquals("GET", request.getMethod());
assertEquals(expected.getTranslation(), result.getTranslation());
}
Aggregations