WineryVersion implements Comparable<WineryVersion> { @Override public String toString() { String versionString = componentVersion; if (this.wineryVersion > 0) { versionString += (StringUtils.isEmpty(versionString) ? "" : WINERY_VERSION_SEPARATOR) + WINERY_VERSION_PREFIX + wineryVersion; if (this.workInProgressVersion > 0) { versionString += WINERY_VERSION_SEPARATOR + WINERY_WIP_VERSION_PREFIX + this.workInProgressVersion; } } return versionString; } WineryVersion();  WineryVersion(String componentVersion, int wineryVersion, int workInProgressVersion); String getComponentVersion(); void setComponentVersion(String componentVersion); int getWineryVersion(); void setWineryVersion(int wineryVersion); int getWorkInProgressVersion(); void setWorkInProgressVersion(int workInProgressVersion); boolean isCurrentVersion(); void setCurrentVersion(boolean currentVersion); boolean isLatestVersion(); void setLatestVersion(boolean latestVersion); boolean isEditable(); void setEditable(boolean editable); boolean isReleasable(); void setReleasable(boolean releasable); @JsonIgnore boolean isVersionedInWinery(); @Override @ADR(19) int compareTo(WineryVersion o); @Override String toString(); static String WINERY_NAME_FROM_VERSION_SEPARATOR; static String WINERY_VERSION_SEPARATOR; static String WINERY_VERSION_PREFIX; static String WINERY_WIP_VERSION_PREFIX; }
@Test public void testToString() { String componentVersion = "789.67.79823"; int wineryVersion = 2347; int wipVersion = 3673; WineryVersion v = new WineryVersion(componentVersion, wineryVersion, wipVersion); String expected = componentVersion + WineryVersion.WINERY_VERSION_SEPARATOR + WineryVersion.WINERY_VERSION_PREFIX + wineryVersion + WineryVersion.WINERY_VERSION_SEPARATOR + WineryVersion.WINERY_WIP_VERSION_PREFIX + wipVersion; assertEquals(expected, v.toString()); }
@Test public void testToStringWithoutWipVersion() { String componentVersion = "8.0.6-alpha"; int wineryVersion = 1; int wipVersion = 0; WineryVersion v = new WineryVersion(componentVersion, wineryVersion, wipVersion); String expected = componentVersion + WineryVersion.WINERY_VERSION_SEPARATOR + WineryVersion.WINERY_VERSION_PREFIX + wineryVersion; assertEquals(expected, v.toString()); }
@Test public void testToStringWithoutWineryVersion() { String componentVersion = "funnyVersionIdentifier"; int wineryVersion = 0; int wipVersion = 0; WineryVersion v = new WineryVersion(componentVersion, wineryVersion, wipVersion); assertEquals(componentVersion, v.toString()); }
@Test public void testToStringWithoutComponentButWineryVersion() { String componentVersion = ""; int wineryVersion = 6; int wipVersion = 0; WineryVersion v = new WineryVersion(componentVersion, wineryVersion, wipVersion); String expected = componentVersion + WineryVersion.WINERY_VERSION_PREFIX + wineryVersion; assertEquals(expected, v.toString()); }