323334353637383940
{ @Test public void shouldBeAbleToExtract() throws Exception { Version version = VersionUtil.extract("1.2"); Assert.assertEquals(1, version.getMajor()); Assert.assertEquals(2, version.getMinor()); }
404142434445464748
} @Test public void shouldBeAbleToExtractWithMultipleDigits() throws Exception { Version version = VersionUtil.extract("10.300"); Assert.assertEquals(10, version.getMajor()); Assert.assertEquals(300, version.getMinor()); }
484950515253545556
} @Test public void shouldBeAbleToExtractWithBuild() throws Exception { Version version = VersionUtil.extract("1.2.50.A"); Assert.assertEquals(1, version.getMajor()); Assert.assertEquals(2, version.getMinor()); }
565758596061626364
} @Test public void shouldReturnZeroVersionOnNull() throws Exception { Version version = VersionUtil.extract(null); Assert.assertEquals(0, version.getMajor()); Assert.assertEquals(0, version.getMinor()); }
646566676869707172
} @Test public void shouldReturnZeroVersionOnNullUnMatched() throws Exception { Version version = VersionUtil.extract("243223.A"); Assert.assertEquals(0, version.getMajor()); Assert.assertEquals(0, version.getMinor()); }
72737475767778798081
} @Test public void shouldBeGreaterEqual() { Version greater = VersionUtil.extract("7.1"); Version then = VersionUtil.extract("7.1"); Assert.assertTrue(VersionUtil.isGraterThenOrEqual(greater, then)); }
81828384858687888990
} @Test public void shouldBeGreaterThen() { Version greater = VersionUtil.extract("7.2"); Version then = VersionUtil.extract("7.1"); Assert.assertTrue(VersionUtil.isGraterThenOrEqual(greater, then)); }
90919293949596979899
} @Test public void shouldBeLessEqual() { Version less = VersionUtil.extract("7.1"); Version then = VersionUtil.extract("7.1"); Assert.assertTrue(VersionUtil.isLessThenOrEqual(less, then)); }
99100101102103104105106107108
} @Test public void shouldBeLessThen() { Version less = VersionUtil.extract("7.1"); Version then = VersionUtil.extract("7.2"); Assert.assertTrue(VersionUtil.isLessThenOrEqual(less, then)); }