BundleCache { public Bundle getBundleFromMetadataFile(File file) { if (!cache.containsKey(file.getPath())) { Bundle bundle = entityBundleLoader.loadMetadata(file, BundleLoadingOperation.EXPORT); if (bundle != null) { cache.put(file.getPath(), bundle); } } 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 getBundleFromMetadataFile() { 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.loadMetadata(file, BundleLoadingOperation.EXPORT)).thenReturn(bundle); BundleCache cache = new BundleCache(entityBundleLoader); cache.getBundleFromMetadataFile(file); Assert.assertTrue(cache.contains(file.getPath())); }