### Question:
FilesApiServiceImpl implements FilesApiService { @Override public ResponseEntity<List<FileMetadata>> getFiles(String spaceGuid, String namespace) { try { List<FileEntry> entries = fileService.listFiles(spaceGuid, namespace); List<FileMetadata> files = entries.stream() .map(this::parseFileEntry) .collect(Collectors.toList()); return ResponseEntity.ok() .body(files); } catch (FileStorageException e) { throw new SLException(e, Messages.COULD_NOT_GET_FILES_0, e.getMessage()); } }  @Override ResponseEntity<List<FileMetadata>> getFiles(String spaceGuid, String namespace); @Override ResponseEntity<FileMetadata> uploadFile(HttpServletRequest request, String spaceGuid, String namespace);  }### Answer:
@Test void testGetMtaFiles() throws Exception { FileEntry entryOne = createFileEntry("test.mtar"); FileEntry entryTwo = createFileEntry("extension.mtaet"); Mockito.when(fileService.listFiles(Mockito.eq(SPACE_GUID), Mockito.eq(NAMESPACE_GUID))) .thenReturn(List.of(entryOne, entryTwo)); ResponseEntity<List<FileMetadata>> response = testedClass.getFiles(SPACE_GUID, NAMESPACE_GUID); assertEquals(HttpStatus.OK, response.getStatusCode()); List<FileMetadata> files = response.getBody(); assertEquals(2, files.size()); assertMetadataMatches(entryOne, files.get(0)); assertMetadataMatches(entryTwo, files.get(1)); }
@Test void testGetMtaFilesError() throws Exception { Mockito.when(fileService.listFiles(Mockito.eq(SPACE_GUID), Mockito.eq(null))) .thenThrow(new FileStorageException("error")); Assertions.assertThrows(SLException.class, () -> testedClass.getFiles(SPACE_GUID, null)); }