use of uk.gov.justice.services.adapter.rest.multipart.FileInputDetails in project microservice_framework by CJSCommonPlatform.
the class SingleFileInputDetailsServiceTest method shouldStoreTheFileInputStream.
@Test
public void shouldStoreTheFileInputStream() throws Exception {
final UUID fileId = randomUUID();
final FileInputDetails fileInputDetails = mock(FileInputDetails.class);
final InputStream inputStream = mock(InputStream.class);
final JsonObject metadata = mock(JsonObject.class);
when(fileInputDetails.getInputStream()).thenReturn(inputStream);
when(fileStorer.store(metadata, inputStream)).thenReturn(fileId);
assertThat(singleFileInputDetailsService.store(fileInputDetails, metadata), is(fileId));
verify(inputStream).close();
}
Aggregations