use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.
the class TestVersion method constructFromStringInvalidMinorNegative.
@Test
public void constructFromStringInvalidMinorNegative() {
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage(Matchers.is("minor \"-1\" can not be negative, version \"1.-1\"."));
version = new Version("1.-1");
}
use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.
the class TestVersion method constructFromStringNormal.
@Test
public void constructFromStringNormal() {
version = new Version("1.1.1.1");
Assert.assertEquals("1.1.1.1", version.getVersion());
Assert.assertEquals(1, version.getMajor());
Assert.assertEquals(1, version.getMinor());
Assert.assertEquals(1, version.getPatch());
Assert.assertEquals(1, version.getBuild());
}
use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.
the class TestVersion method constructFromStringInvalidMajorDot.
@Test
public void constructFromStringInvalidMajorDot() {
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage(Matchers.is("Invalid minor \"\", version \"1.\"."));
expectedException.expectCause(Matchers.instanceOf(NumberFormatException.class));
version = new Version("1.");
}
use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.
the class VersionRuleStartFromParser method parse.
@Override
public VersionRule parse(String strVersionRule) {
int pos = strVersionRule.indexOf('+');
if (pos <= 0 || pos != strVersionRule.length() - 1) {
return null;
}
Version from = new Version(strVersionRule.substring(0, pos));
return new StartFromVersionRule(from.getVersion() + "+", from);
}
use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.
the class TestVersionUtils method getOrCreate.
@Test
public void getOrCreate() {
Version v = VersionUtils.getOrCreate("1.0.0");
Assert.assertEquals("1.0.0.0", v.getVersion());
Assert.assertSame(v, VersionUtils.getOrCreate("1.0.0"));
}
Aggregations