BundleCache { public Bundle getBundleFromFile(File file) { if (!cache.containsKey(file.getPath())) { cache.put(file.getPath(), entityBundleLoader.load(file, BundleLoadingOperation.EXPORT)); } return cache.get(file.getPath()); } @Inject  BundleCache(final EntityBundleLoader entityBundleLoader); Bundle getBundle(String bundlePath); boolean contains(String bundlePath); void putBundle(String bundlePath, Bundle bundle); Bundle getBundleFromFile(File file); Bundle getBundleFromMetadataFile(File file);  }
@Test void getBundleFromFile() { File file = new File(TEST_STRING); Policy policy = new Policy(); policy.setName(TEST_STRING); policy.setPath(TEST_STRING); Bundle bundle = new Bundle(); bundle.getPolicies().put(policy.getPath(), policy); when(entityBundleLoader.load(file, BundleLoadingOperation.EXPORT)).thenReturn(bundle); BundleCache cache = new BundleCache(entityBundleLoader); cache.getBundleFromFile(file); Assert.assertTrue(cache.contains(file.getPath())); }