use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.GetModelOptions in project java-sdk by watson-developer-cloud.
the class LanguageTranslatorIT method testGetModel.
/**
* Test Get model by id.
*/
@Test
public void testGetModel() {
GetModelOptions getOptions = new GetModelOptions.Builder(ENGLISH_TO_SPANISH).build();
final TranslationModel model = service.getModel(getOptions).execute();
assertNotNull(model);
}
use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.GetModelOptions in project java-sdk by watson-developer-cloud.
the class LanguageTranslatorTest method testGetModel.
/**
* Test Get Model.
*
* @throws InterruptedException the interrupted exception
*/
@Test
public void testGetModel() throws InterruptedException {
server.enqueue(jsonResponse(model));
GetModelOptions getOptions = new GetModelOptions.Builder(model.getModelId()).build();
final TranslationModel returnedModel = service.getModel(getOptions).execute();
final RecordedRequest request = server.takeRequest();
assertEquals(GET_MODELS_PATH + "/" + model.getModelId(), request.getPath());
assertEquals(model, returnedModel);
}
use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.GetModelOptions in project java-sdk by watson-developer-cloud.
the class LanguageTranslatorTest method testGetModelWithNull.
/**
* Test get model with null.
*/
@Test(expected = IllegalArgumentException.class)
public void testGetModelWithNull() {
final String modelId = null;
GetModelOptions getOptions = new GetModelOptions.Builder(modelId).build();
service.getModel(getOptions).execute();
}
use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.GetModelOptions in project java-sdk by watson-developer-cloud.
the class SpeechToTextIT method testGetModel.
/**
* Test get model.
*/
@Test
public void testGetModel() {
GetModelOptions getOptions = new GetModelOptions.Builder().modelId(EN_BROADBAND16K).build();
SpeechModel model = service.getModel(getOptions).execute();
assertNotNull(model);
assertNotNull(model.getName());
assertNotNull(model.getLanguage());
assertNotNull(model.getRate());
assertNotNull(model.getUrl());
assertNotNull(model.getDescription());
assertNotNull(model.getSessions());
assertNotNull(model.getSupportedFeatures().isCustomLanguageModel());
assertNotNull(model.getSupportedFeatures().isSpeakerLabels());
}
use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.GetModelOptions in project java-sdk by watson-developer-cloud.
the class SpeechToTextTest method testGetModel.
/**
* Test get model.
*
* @throws Exception the exception
*/
@Test
public void testGetModel() throws Exception {
final MockResponse mockResponse = new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody(GSON.toJson(speechModel));
server.enqueue(mockResponse);
GetModelOptions getOptionsString = new GetModelOptions.Builder().modelId("not-a-real-Model").build();
SpeechModel model = service.getModel(getOptionsString).execute();
RecordedRequest request = server.takeRequest();
assertNotNull(model);
assertEquals(model, speechModel);
assertEquals(GET, request.getMethod());
server.enqueue(mockResponse);
GetModelOptions getOptionsGetter = new GetModelOptions.Builder().modelId("not-a-real-Model").build();
model = service.getModel(getOptionsGetter).execute();
request = server.takeRequest();
assertNotNull(model);
assertEquals(model, speechModel);
assertEquals(GET, request.getMethod());
TestUtils.assertNoExceptionsOnGetters(model);
}
Aggregations