/** * Checks that a null version string results in a null version object. */ @Test public void testNullStringProducesNullVersion() { Version version = VersionMapper.fromVersionString(null); assertNull(version); }
/** * Asserts that the major version number extracted from the given version text is the expected. * * @param expected the expected major version number * @param text the complete version string */ private void assertMajor(Integer expected, String text) { Version version = VersionMapper.fromVersionString(text); assertNotNull(version); Integer actual = version.getMajor(); assertEquals(expected, actual, "Incorrect major version number"); }
/** * Asserts that the build version number extracted from the given version text is the expected. * * @param expected the expected build version number * @param text the complete version string */ private void assertBuild(Integer expected, String text) { Version version = VersionMapper.fromVersionString(text); assertNotNull(version); Integer actual = version.getBuild(); assertEquals(expected, actual, "Incorrect build version number"); }
/** * Asserts that the revision version number extracted from the given version text is the expected. * * @param expected the expected revision version number * @param text the complete version string */ private void assertRevision(Integer expected, String text) { Version version = VersionMapper.fromVersionString(text); assertNotNull(version); Integer actual = version.getRevision(); assertEquals(expected, actual, "Incorrect revision version number"); } }
/** * Asserts that the minor version number extracted from the given version text is the expected. * * @param expected the expected minor version number * @param text the complete version string */ private void assertMinor(Integer expected, String text) { Version version = VersionMapper.fromVersionString(text); assertNotNull(version); Integer actual = version.getMinor(); assertEquals(expected, actual, "Incorrect minor version number"); }
/** * Checks that an empty version string results in a version object, containing an empty string in the * {@code full_version} attribute. */ @Test public void testEmptyStringProducesEmptyVersion() { Version version = VersionMapper.fromVersionString(""); assertNotNull(version); assertEquals("", version.getFullVersion()); }
/** * Checks that a version string that doesn't match the version number pattern doesn't generate an exception, and * that the complete version string is reported in the {@code full_version} property. */ @Test public void testNoMatchDoesntCrash() { Version version = VersionMapper.fromVersionString("ugly"); assertNotNull(version); assertEquals("ugly", version.getFullVersion()); }
String kernelVersionString = entity.getGuestOsKernelVersion(); if(StringUtils.isNotEmpty(kernelVersionString)) { org.ovirt.engine.api.model.Version kernelVersion = VersionMapper.fromVersionString(kernelVersionString); if(kernelVersion != null) { if(os.getKernel() == null) { os.setVersion(VersionMapper.fromVersionString(osVersionString)); if(os.getVersion() != null) { os.getVersion().setFullVersion(entity.getGuestOsVersion());