NpmProxyCacheInvalidatorFacetImpl extends FacetSupport { @Subscribe @AllowConcurrentEvents protected void on(final RepositoryUpdatedEvent event) { final Repository repository = event.getRepository(); repository.optionalFacet(NpmProxyFacet.class).ifPresent(npm -> { if (!Objects.equals(getRemoteUrl(repository.getConfiguration()), getRemoteUrl(event.getOldConfiguration()))) { npm.invalidateProxyCaches(); } }); }    }
@Test public void testOnUrlChange() { underTest .on(new RepositoryUpdatedEvent(mockRepository("http: verify(npmProxyFacet).invalidateProxyCaches(); }
@Test public void testOnNoUrlChange() { underTest .on(new RepositoryUpdatedEvent(mockRepository("http: verify(npmProxyFacet, never()).invalidateProxyCaches(); }