@Test public void testSuccessfulVersionQuery() throws Exception { String testVersionName = expectedVersionMap.keySet().iterator().next(); Version expectedVersion = expectedVersionMap.get(testVersionName); Version returnedVersion = versionUtil.getVersion(testVersionName); int failureCount = 0; StringBuilder failureReport = new StringBuilder(); failureCount = failureCount + failuresInReturnedVersionComparison(testVersionName, expectedVersion, returnedVersion, failureReport); if (failureCount > 0) { fail(Integer.toString(failureCount) + " failed test conditions. Details follow... " + failureReport.toString()); } return; }
public Version getVersion(String version) throws InvalidVersionException { if (version != null && version.trim() != "") { for (Version v : getVersions()) { if (v.getVersion().equals(version)) { return v; } } } else { throw new InvalidVersionException("'' is not a valid version."); } throw new InvalidVersionException("'" + version + "' is not a valid version."); }
VersionUtil { public Version getVersion(String version) throws InvalidVersionException { if (version != null && version.trim() != "") { for (Version v : getVersions()) { if (v.getVersion().equals(version)) { return v; } } } else { throw new InvalidVersionException("'' is not a valid version."); } throw new InvalidVersionException("'" + version + "' is not a valid version."); } }
VersionUtil { public Version getVersion(String version) throws InvalidVersionException { if (version != null && version.trim() != "") { for (Version v : getVersions()) { if (v.getVersion().equals(version)) { return v; } } } else { throw new InvalidVersionException("'' is not a valid version."); } throw new InvalidVersionException("'" + version + "' is not a valid version."); }  }
VersionUtil { public Version getVersion(String version) throws InvalidVersionException { if (version != null && version.trim() != "") { for (Version v : getVersions()) { if (v.getVersion().equals(version)) { return v; } } } else { throw new InvalidVersionException("'' is not a valid version."); } throw new InvalidVersionException("'" + version + "' is not a valid version."); }  List<Version> getVersions(); Version getVersion(String version); Version getDefaultVersion(); }
VersionUtil { public Version getVersion(String version) throws InvalidVersionException { if (version != null && version.trim() != "") { for (Version v : getVersions()) { if (v.getVersion().equals(version)) { return v; } } } else { throw new InvalidVersionException("'' is not a valid version."); } throw new InvalidVersionException("'" + version + "' is not a valid version."); }  List<Version> getVersions(); Version getVersion(String version); Version getDefaultVersion(); static final String DEFAULT_VERSION; }