use of com.ibm.watson.developer_cloud.language_translator.v2.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