@Test public void dependenciesCacheTest() { Map<String, Dependency> cacheMap = new HashMap<>(); Dependency depA = new DependencyBuilder().id("depenA-1.0-A.zip").sha1("sha1A").md5("md5A").build(); cacheMap.put("depA", depA); Dependency depC = new DependencyBuilder().id("depenC-3.4-C.gzip").sha1("sha1C").md5("md5C").build(); cacheMap.put("depC", depC); Path projectDir = null; try { projectDir = TestUtils.createTempDir("pipCacheTest"); DependenciesCache nullCache = DependenciesCache.getProjectDependenciesCache(projectDir, log); assertNull(nullCache, "Expecting null cache read."); DependenciesCache.updateDependenciesCache(cacheMap, projectDir); DependenciesCache readCache = DependenciesCache.getProjectDependenciesCache(projectDir, log); assertNotNull(readCache, "Expecting cache read."); Dependency depATest = readCache.getDependency("depA"); assertEquals(depATest, depA, String.format("Actual: %s\nExpected: %s", mapper.writeValueAsString(depATest), mapper.writeValueAsString(depA))); Dependency depCTest = readCache.getDependency("depC"); assertEquals(depCTest, depC, String.format("Actual: %s\nExpected: %s", mapper.writeValueAsString(depCTest), mapper.writeValueAsString(depC))); Dependency nonExistingDepTTest = readCache.getDependency("depT"); assertNull(nonExistingDepTTest, String.format("Actual: %s\nExpected null", mapper.writeValueAsString(nonExistingDepTTest))); } catch (IOException e) { fail(ExceptionUtils.getStackTrace(e)); } finally { if (projectDir != null) { FileUtils.deleteQuietly(projectDir.toFile()); } } }
DependenciesCache() { this.dependencies = new HashMap<>(); }
DependenciesCache { DependenciesCache() { this.dependencies = new HashMap<>(); } }
DependenciesCache { DependenciesCache() { this.dependencies = new HashMap<>(); } DependenciesCache(); }
DependenciesCache { DependenciesCache() { this.dependencies = new HashMap<>(); } DependenciesCache(); int getVersion(); void setVersion(int version); Map<String, Dependency> getDependencies(); void setDependencies(Map<String, Dependency> dependencies); }
DependenciesCache { DependenciesCache() { this.dependencies = new HashMap<>(); } DependenciesCache(); int getVersion(); void setVersion(int version); Map<String, Dependency> getDependencies(); void setDependencies(Map<String, Dependency> dependencies);  }