### Question:
RevisionPattern { public OptionalLong extractRevision(String buildName) { String regex = getRegex(); Matcher matcher = Pattern.compile(regex).matcher(buildName); if (matcher.matches()) { String token = matcher.group(1); return OptionalLong.of( Long.parseLong(token, 10) ); } else { return OptionalLong.empty(); } } @ConstructorProperties({"pattern"})  RevisionPattern(String pattern); boolean isValidBuildName(String buildName); OptionalLong extractRevision(String buildName); RevisionPattern clone(Function<String, String> replacementFunction);  }### Answer:
@Test public void extract_revision() { RevisionPattern r = new RevisionPattern("11.8.4.*-{revision}"); assertFalse(r.extractRevision("11.8.5.0-123456").isPresent()); assertFalse(r.extractRevision("11.8.4-123456").isPresent()); assertEquals(123456L, r.extractRevision("11.8.4.5-123456").getAsLong()); assertFalse(r.extractRevision("11.8.4.5-v123456").isPresent()); }