use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.
the class TestVersion method constructFromStringInvalidMajorNegative.
@Test
public void constructFromStringInvalidMajorNegative() {
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage(Matchers.is("major \"-1\" can not be negative, version \"-1\"."));
version = new Version("-1");
}
use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.
the class TestVersion method constructFromStringInvalidEmpty.
@Test
public void constructFromStringInvalidEmpty() {
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage(Matchers.is("Invalid major \"\", version \"\"."));
expectedException.expectCause(Matchers.instanceOf(NumberFormatException.class));
version = new Version("");
}
use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.
the class TestVersion method constructFromStringNormalOnlyMajor.
@Test
public void constructFromStringNormalOnlyMajor() {
version = new Version("1");
Assert.assertEquals("1.0.0.0", version.getVersion());
Assert.assertEquals(1, version.getMajor());
Assert.assertEquals(0, version.getMinor());
Assert.assertEquals(0, version.getPatch());
}
use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.
the class TestVersion method constructFromNumber.
@Test
public void constructFromNumber() {
version = new Version(s1, s1, s1, s1);
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.getPatch());
}
use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.
the class TestVersion method constructFromStringNormalOnlyMajorMinor.
@Test
public void constructFromStringNormalOnlyMajorMinor() {
version = new Version("1.1");
Assert.assertEquals("1.1.0.0", version.getVersion());
Assert.assertEquals(1, version.getMajor());
Assert.assertEquals(1, version.getMinor());
Assert.assertEquals(0, version.getPatch());
}
Aggregations