@Test public void testStringRepresentation() { assertEquals("10.0.1-1234", new LibraryVersion(10, 0, 1, 1234).toString()); assertEquals("10.0-1234", new LibraryVersion("10.0-1234").toString()); assertEquals("10-1234", new LibraryVersion("10-1234").toString()); assertEquals("10.0.1", new LibraryVersion(10, 0, 1).toString()); assertEquals("10.1", new LibraryVersion(10, 1).toString()); assertEquals("10", new LibraryVersion(10).toString()); }
@Override public String toString() { String result = "" + major; if (minor != null) { result += "." + minor; if (sub != null) result += "." + sub; } if (build != null) result += "-" + build; return result; }
LibraryVersion { @Override public String toString() { String result = "" + major; if (minor != null) { result += "." + minor; if (sub != null) result += "." + sub; } if (build != null) result += "-" + build; return result; } }
LibraryVersion { @Override public String toString() { String result = "" + major; if (minor != null) { result += "." + minor; if (sub != null) result += "." + sub; } if (build != null) result += "-" + build; return result; } LibraryVersion(String version);  LibraryVersion(int major, int minor, int sub, int build);  LibraryVersion(int major, int minor, int sub);  LibraryVersion(int major, int minor);  LibraryVersion(int major); }
LibraryVersion { @Override public String toString() { String result = "" + major; if (minor != null) { result += "." + minor; if (sub != null) result += "." + sub; } if (build != null) result += "-" + build; return result; } LibraryVersion(String version);  LibraryVersion(int major, int minor, int sub, int build);  LibraryVersion(int major, int minor, int sub);  LibraryVersion(int major, int minor);  LibraryVersion(int major); boolean equals(LibraryVersion v); @Override boolean equals(Object o); @Override int hashCode(); int getMinor(); int getMajor(); int getSub(); int getBuild(); @Override String toString(); }
LibraryVersion { @Override public String toString() { String result = "" + major; if (minor != null) { result += "." + minor; if (sub != null) result += "." + sub; } if (build != null) result += "-" + build; return result; } LibraryVersion(String version);  LibraryVersion(int major, int minor, int sub, int build);  LibraryVersion(int major, int minor, int sub);  LibraryVersion(int major, int minor);  LibraryVersion(int major); boolean equals(LibraryVersion v); @Override boolean equals(Object o); @Override int hashCode(); int getMinor(); int getMajor(); int getSub(); int getBuild(); @Override String toString();  }