### Question:
DCContentUtils { public static Map<String, List<DCConent>> getDCS(FedoraAccess fedoraAccess, SolrAccess solrAccess, List<String> pids) throws IOException { Map<String, List<DCConent>> maps = new HashMap<String, List<DCConent>>(); for (String pid : pids) { ObjectPidsPath[] paths = solrAccess.getPath(pid); if (paths.length > 0) { List<DCConent> dcs = new ArrayList<DCConent>(); String[] pathFromLeaf = paths[0].getPathFromLeafToRoot(); for (int i = 0; i < pathFromLeaf.length; i++) { String pidFromPath = pathFromLeaf[i]; if (!pidFromPath.equals(SpecialObjects.REPOSITORY.getPid())) { if (!cacheContains(pidFromPath)) { Document dcl = fedoraAccess.getDC(pidFromPath); DCConent content = DCUtils.contentFromDC(dcl); putIntoCache(pidFromPath, content); } dcs.add(getFromCache(pidFromPath)); } } maps.put(pid, dcs); } } return maps; }  static Map<String, List<DCConent>> getDCS(FedoraAccess fedoraAccess, SolrAccess solrAccess, List<String> pids);  }### Answer:
@Test public void testCache() throws ParserConfigurationException, SAXException, IOException { InputStream is = DCContentUtilsTest.class.getClassLoader().getResourceAsStream("cz/incad/kramerius/fedora/res/0eaa6730-9068-11dd-97de-000d606f5dc6.dc.xml"); Document dcDocument = XMLUtils.parseDocument(is,true); List<String> pids = generatePIDS(); FedoraAccess fa = EasyMock.createMock(FedoraAccess.class); for (int i = 0; i < MAX; i++) { EasyMock.expect(fa.getDC(pids.get(i))).andReturn(dcDocument).anyTimes(); } SolrAccess sa = EasyMock.createMock(SolrAccess.class); for (int i = 0; i < MAX; i++) { ObjectPidsPath pidPath = new ObjectPidsPath(pids.get(i)).injectRepository(); EasyMock.expect(sa.getPath(pids.get(i))).andReturn(new ObjectPidsPath[] {pidPath}).anyTimes(); } EasyMock.replay(fa,sa); for (int i = 0; i < pids.size(); i++) { String pid = pids.get(i); DCContentUtils.getDCS(fa, sa, Arrays.asList(pid)); } List<String> tailed = tail(DCContentUtils._CACHE_SIZE,pids); Assert.assertTrue(DCContentUtils._CACHE.size() == DCContentUtils._CACHE_SIZE); Assert.assertTrue(DCContentUtils._CACHE_HISTORY.size() == DCContentUtils._CACHE_SIZE); for (int i = 0; i < tailed.size(); i++) { Assert.assertTrue(DCContentUtils._CACHE_HISTORY.get(i).equals(tailed.get(i))); } }