CacheReader { public String get(String key){ String text = null; if(this.cache.containsKey(key)){ text = this.cache.get(key).get(); if(text == null){ addValueInCache(key); } } else{ addValueInCache(key); text = this.cache.get(key).get(); } return text; } CacheReader(Map<String,SoftReference<String>> mapCache, final String path);  CacheReader(final String path); String get(String key); boolean addValueInCache(String fileName);  }
@Test public void whenAddDataToCacheWeGetItFromCachePossible() throws Exception { CacheReader cache = new CacheReader("d:\\Test"); String textFile = cache.get("Adress.txt"); Assert.assertThat(textFile,is("Пенза\nМосква\nПитер\n")); }