ResourceChangeDetector { public boolean checkChangeForGroup(final String uri, final String groupName) throws IOException { notNull(uri); notNull(groupName); LOG.debug("group={}, uri={}", groupName, uri); final ResourceChangeInfo resourceInfo = changeInfoMap.get(uri); if (resourceInfo.isCheckRequiredForGroup(groupName)) { final InputStream inputStream = locatorFactory.locate(uri); try (inputStream) { final String currentHash = hashStrategy.getHash(inputStream); resourceInfo.updateHashForGroup(currentHash, groupName); } } return resourceInfo.isChanged(groupName); }  void reset(); boolean checkChangeForGroup(final String uri, final String groupName);  }
@Test(expected = NullPointerException.class) public void cannotCheckInvalidUriForChange() throws Exception { victim.checkChangeForGroup(null, GROUP1_NAME); }
@Test(expected = NullPointerException.class) public void cannotCheckInvalidGroupNameForChange() throws Exception { victim.checkChangeForGroup("resource", null); }
@Test public void shouldRequireChangeAtFirstCheck() throws Exception { assertTrue(victim.checkChangeForGroup("resource", GROUP1_NAME)); }