Search in sources :

Example 11 with Translation

use of com.ibm.watson.developer_cloud.text_to_speech.v1.model.Translation 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());
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) Translation(com.ibm.watson.developer_cloud.text_to_speech.v1.model.Translation) Word(com.ibm.watson.developer_cloud.text_to_speech.v1.model.Word) GetWordOptions(com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetWordOptions) WatsonServiceUnitTest(com.ibm.watson.developer_cloud.WatsonServiceUnitTest) Test(org.junit.Test)

Aggregations

Word (com.ibm.watson.developer_cloud.text_to_speech.v1.model.Word)8 Test (org.junit.Test)7 WatsonServiceTest (com.ibm.watson.developer_cloud.WatsonServiceTest)5 AddWordOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordOptions)5 Translation (com.ibm.watson.developer_cloud.text_to_speech.v1.model.Translation)5 GetWordOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetWordOptions)4 AddWordsOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordsOptions)3 ListWordsOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.ListWordsOptions)3 SynthesizeOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.SynthesizeOptions)3 Words (com.ibm.watson.developer_cloud.text_to_speech.v1.model.Words)3 InputStream (java.io.InputStream)3 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)2 RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)2 DeleteWordOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.DeleteWordOptions)2 File (java.io.File)2 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)2 TranslationResult (com.ibm.watson.developer_cloud.language_translation.v2.model.TranslationResult)1 TranslateOptions (com.ibm.watson.developer_cloud.language_translator.v2.model.TranslateOptions)1 CreateVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.CreateVoiceModelOptions)1 DeleteVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.DeleteVoiceModelOptions)1