Version { private int parse(int index) { return Integer.parseInt(this.version.split(Pattern.quote(Strings.DASH))[0].split(Pattern.quote(Strings.DOT))[index]); } Version(String version); int getMajor(); int getMinor(); int getRevision(); @Override String toString(); static final Version CURRENT; }
@Test public void finalRelease() { parse(new Version("1.2.3"), 1, 2, 3); }
@Test public void rc() { parse(new Version("1.2.3-rc-4"), 1, 2, 3); }
@Test public void beta() { parse(new Version("1.2.3-beta-4"), 1, 2, 3); }
@Test public void alpha() { parse(new Version("1.2.3-alpha-4"), 1, 2, 3); }
@Test public void finalSnapshot() { parse(new Version("1.2.3-SNAPSHOT"), 1, 2, 3); }
@Test public void betaSnapshot() { parse(new Version("1.2.3-beta-4-SNAPSHOT"), 1, 2, 3); }