use of com.opensymphony.xwork2.mock.MockInterceptor in project aws-cloud-meta by prisma-capacity.
the class ECSMetaDataReaderTest method testSuccessfulRead.
@Test
void testSuccessfulRead() throws IOException {
val interceptor = new MockInterceptor();
val url = "http://example.com";
interceptor.addRule().get(url + "/task").respond(RESPONSE);
val client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
when(objectMapper.readValue(RESPONSE, TaskMetaData.class)).thenReturn(taskMetaData);
val uut = new ECSMetaDataReader(url, client, objectMapper);
val result = uut.readTaskMetaData();
assertTrue(result.isPresent());
verify(objectMapper).readValue(RESPONSE, TaskMetaData.class);
}
use of com.opensymphony.xwork2.mock.MockInterceptor in project aws-cloud-meta by prisma-capacity.
the class ECSMetaDataReaderTest method testUnsuccessfulRead.
@Test
void testUnsuccessfulRead() {
val interceptor = new MockInterceptor();
val url = "http://example.com";
interceptor.addRule().get(url + "/task").respond(404);
val client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
val uut = new ECSMetaDataReader(url, client, objectMapper);
val result = uut.readTaskMetaData();
assertFalse(result.isPresent());
verifyNoInteractions(objectMapper);
}
Aggregations