@Test public void noVersion() { assertThat(VersionExtractor.extractVersion(""), is(notNullValue())); assertThat(VersionExtractor.extractVersion(null), is(notNullValue())); }
public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could not find a version in payload [" + payload + "]"); }
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could not find a version in payload [" + payload + "]"); } }
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could not find a version in payload [" + payload + "]"); } private  VersionExtractor(); }
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could not find a version in payload [" + payload + "]"); } private  VersionExtractor(); static String extractVersion(final String payload); }
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could not find a version in payload [" + payload + "]"); } private  VersionExtractor(); static String extractVersion(final String payload);  }