### Question:
FileSystemConfigService extends AbstractWorkspaceAwareResourceService<FileSystem> { public FileSystem getByIdFromAnyAvailableWorkspace(Long id) { return fileSystemRepository.findById(id).orElseThrow(notFound("File system", id)); }  @Override WorkspaceResourceRepository<FileSystem, Long> repository(); FileSystem getByIdFromAnyAvailableWorkspace(Long id);  }### Answer:
@Test public void testGetWhenDatabaseHasEntryWithProvidedIdThenThatactualShouldReturn() { FileSystem expected = createFileSystem(); when(fileSystemRepository.findById(TEST_FILES_SYSTEM_ID)).thenReturn(Optional.of(expected)); FileSystem actual = underTest.getByIdFromAnyAvailableWorkspace(TEST_FILES_SYSTEM_ID); Assert.assertEquals(expected, actual); Assert.assertEquals(expected.getId(), actual.getId()); verify(fileSystemRepository, times(1)).findById(TEST_FILES_SYSTEM_ID); }
@Test public void testGetWhenThereIsNoEntryWithGivenIdThenFileSystemConfigExceptionShouldComeInsteadOfNull() { when(fileSystemRepository.findById(NOT_EXISTING_ID)).thenReturn(Optional.ofNullable(null)); expectedException.expect(NotFoundException.class); expectedException.expectMessage(String.format(NOT_FOUND_EXCEPTION_MESSAGE, NOT_EXISTING_ID)); underTest.getByIdFromAnyAvailableWorkspace(NOT_EXISTING_ID); verify(fileSystemRepository, times(1)).findById(NOT_EXISTING_ID); }