### Question:
LibraryServiceImpl implements LibraryService { @Override @SuppressWarnings("unchecked") public List<LibInfoRecord> getLibInfo(String user, String project, String exploratoryName) { Document document = libraryDAO.findAllLibraries(user, project, exploratoryName); Map<LibKey, List<LibraryStatus>> model = new TreeMap<>(Comparator.comparing(LibKey::getName) .thenComparing(LibKey::getVersion) .thenComparing(LibKey::getGroup)); if (document.get(ExploratoryLibDAO.EXPLORATORY_LIBS) != null) { List<Document> exploratoryLibs = (List<Document>) document.get(ExploratoryLibDAO.EXPLORATORY_LIBS); exploratoryLibs.forEach(e -> populateModel(exploratoryName, e, model, "notebook")); } if (document.get(ExploratoryLibDAO.COMPUTATIONAL_LIBS) != null) { Document computationalLibs = getLibsOfActiveComputationalResources(document); populateComputational(computationalLibs, model, "cluster"); } List<LibInfoRecord> libInfoRecords = new ArrayList<>(); for (Map.Entry<LibKey, List<LibraryStatus>> entry : model.entrySet()) { libInfoRecords.add(new LibInfoRecord(entry.getKey(), entry.getValue())); } return libInfoRecords; }  @Override @SuppressWarnings("unchecked") List<Document> getLibs(String user, String project, String exploratoryName, String computationalName); @Override @SuppressWarnings("unchecked") List<LibInfoRecord> getLibInfo(String user, String project, String exploratoryName); @Override String installComputationalLibs(UserInfo ui, String project, String expName, String compName,
										   List<LibInstallDTO> libs); @Override String installExploratoryLibs(UserInfo ui, String project, String expName, List<LibInstallDTO> libs);  }### Answer:
@Test public void getLibInfo() { Document document = new Document(); when(libraryDAO.findAllLibraries(anyString(), anyString(), anyString())).thenReturn(document); List<LibInfoRecord> expectedList = new ArrayList<>(); List<LibInfoRecord> actualList = libraryService.getLibInfo(USER, PROJECT, EXPLORATORY_NAME); assertNotNull(actualList); assertEquals(expectedList, actualList); verify(libraryDAO).findAllLibraries(USER, PROJECT, EXPLORATORY_NAME); verifyNoMoreInteractions(libraryDAO); }
@Test public void getLibInfoWhenListsOfExploratoryAndComputationalLibsAreNotEmpty() { when(libraryDAO.findAllLibraries(anyString(), anyString(), anyString())) .thenReturn(getDocumentWithExploratoryAndComputationalLibs()); List<LibInfoRecord> expectedList = getLibInfoRecordList(); List<LibInfoRecord> actualList = libraryService.getLibInfo(USER, PROJECT, EXPLORATORY_NAME); assertNotNull(actualList); assertEquals(expectedList, actualList); verify(libraryDAO).findAllLibraries(USER, PROJECT, EXPLORATORY_NAME); verifyNoMoreInteractions(libraryDAO); }