### Question:
OsmChangeResource { public int getOsmState(Granularity granularity) { String result = restOperations.getForObject(STATE_URL, String.class, granularity.name()); Pattern pattern = Pattern.compile(".*sequenceNumber=(\\d*).*", Pattern.MULTILINE | Pattern.DOTALL); Matcher matcher = pattern.matcher(result); if (matcher.matches()) { String state = matcher.group(1); return Integer.parseInt(state); } throw new RuntimeException("Cannot find sequenceNumber in [" + result + "]"); } @Autowired  OsmChangeResource(RestOperations restOperations); int getOsmState(Granularity granularity); OsmChange getOsmChange(String url);  }### Answer:
@Test public void itShouldReturnTheCurrentState() throws Exception { RestTemplate restTemplate = new RestTemplate(); TestUtils.prepareRestTemplateForState(restTemplate, Granularity.hour.name()); int state = new OsmChangeResource(restTemplate).getOsmState(Granularity.hour); assertEquals(8797, state); }