use of com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetVoiceModelOptions in project java-sdk by watson-developer-cloud.
the class CustomizationsTest method testCreateVoiceModel.
/**
* Test create voice model.
*
* @throws InterruptedException the interrupted exception
*/
@Test
public void testCreateVoiceModel() throws InterruptedException {
// Create the custom voice model.
server.enqueue(jsonResponse(voiceModel));
CreateVoiceModelOptions createOptions = new CreateVoiceModelOptions.Builder().name(MODEL_NAME).language(MODEL_LANGUAGE).description(MODEL_DESCRIPTION).build();
final VoiceModel result = service.createVoiceModel(createOptions).execute();
final RecordedRequest request = server.takeRequest();
assertEquals(VOICE_MODELS_PATH, request.getPath());
assertEquals("POST", request.getMethod());
assertEquals(CUSTOMIZATION_ID, result.getCustomizationId());
// Compare expected with actual results.
server.enqueue(jsonResponse(voiceModel));
GetVoiceModelOptions getOptions = new GetVoiceModelOptions.Builder().customizationId(CUSTOMIZATION_ID).build();
final VoiceModel getResult = service.getVoiceModel(getOptions).execute();
final RecordedRequest getRequest = server.takeRequest();
assertEquals(String.format(VOICE_MODEL_PATH, CUSTOMIZATION_ID), getRequest.getPath());
assertEquals("GET", getRequest.getMethod());
assertEquals(voiceModel, getResult);
assertNull(voiceModel.getWords());
assertEquals(voiceModel.getWords(), getResult.getWords());
}
use of com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetVoiceModelOptions in project java-sdk by watson-developer-cloud.
the class CustomizationsTest method testUpdateVoiceModel.
/**
* Test update voice model.
*
* @throws InterruptedException the interrupted exception
*/
@Test
public void testUpdateVoiceModel() throws InterruptedException {
// Create the custom voice model.
server.enqueue(jsonResponse(voiceModel));
CreateVoiceModelOptions createOptions = new CreateVoiceModelOptions.Builder().name(MODEL_NAME).language(MODEL_LANGUAGE).description(MODEL_DESCRIPTION).build();
final VoiceModel result = service.createVoiceModel(createOptions).execute();
final RecordedRequest request = server.takeRequest();
assertEquals(CUSTOMIZATION_ID, result.getCustomizationId());
// Update the custom voice model.
server.enqueue(new MockResponse().setResponseCode(201));
UpdateVoiceModelOptions updateOptions = new UpdateVoiceModelOptions.Builder().customizationId(CUSTOMIZATION_ID).name(MODEL_NAME).description(MODEL_DESCRIPTION).build();
service.updateVoiceModel(updateOptions).execute();
final RecordedRequest updateRequest = server.takeRequest();
assertEquals(String.format(VOICE_MODEL_PATH, CUSTOMIZATION_ID), updateRequest.getPath());
assertEquals("POST", request.getMethod());
// Compare expected with actual results.
server.enqueue(jsonResponse(voiceModel));
GetVoiceModelOptions getOptions = new GetVoiceModelOptions.Builder().customizationId(CUSTOMIZATION_ID).build();
final VoiceModel getResult = service.getVoiceModel(getOptions).execute();
final RecordedRequest getRequest = server.takeRequest();
assertEquals(String.format(VOICE_MODEL_PATH, CUSTOMIZATION_ID), getRequest.getPath());
assertEquals("GET", getRequest.getMethod());
assertEquals(voiceModel, getResult);
assertNull(voiceModel.getWords());
assertEquals(voiceModel.getWords(), getResult.getWords());
}
Aggregations