Search in sources :

Example 16 with Version

use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.

the class TestVersion method testEquals.

@Test
public void testEquals() {
    version = new Version(s1, s1, s1, s1);
    Assert.assertTrue(version.equals(version));
    Assert.assertTrue(version.equals(new Version(s1, s1, s1, s1)));
    Assert.assertFalse(version.equals(null));
}
Also used : Version(org.apache.servicecomb.foundation.common.Version) Test(org.junit.Test)

Example 17 with Version

use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.

the class TestVersion method constructFromStringInvalidNull.

@Test
public void constructFromStringInvalidNull() {
    expectedException.expect(NullPointerException.class);
    version = new Version(null);
}
Also used : Version(org.apache.servicecomb.foundation.common.Version) Test(org.junit.Test)

Example 18 with Version

use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.

the class TestVersion method constructFromStringInvalidPatchNegative.

@Test
public void constructFromStringInvalidPatchNegative() {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(Matchers.is("patch \"-1\" can not be negative, version \"1.1.-1\"."));
    version = new Version("1.1.-1");
}
Also used : Version(org.apache.servicecomb.foundation.common.Version) Test(org.junit.Test)

Example 19 with Version

use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.

the class TestVersion method constructFromStringInvalidMinorDot.

@Test
public void constructFromStringInvalidMinorDot() {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(Matchers.is("Invalid patch \"\", version \"1.1.\"."));
    expectedException.expectCause(Matchers.instanceOf(NumberFormatException.class));
    version = new Version("1.1.");
}
Also used : Version(org.apache.servicecomb.foundation.common.Version) Test(org.junit.Test)

Example 20 with Version

use of org.apache.servicecomb.foundation.common.Version in project java-chassis by ServiceComb.

the class TestVersion method testToString.

@Test
public void testToString() {
    version = new Version(s1, s1, s1, s1);
    Assert.assertEquals("1.1.1.1", version.toString());
}
Also used : Version(org.apache.servicecomb.foundation.common.Version) Test(org.junit.Test)

Aggregations

Version (org.apache.servicecomb.foundation.common.Version)28 Test (org.junit.Test)20 Microservice (org.apache.servicecomb.registry.api.registry.Microservice)4 MicroserviceInstance (org.apache.servicecomb.registry.api.registry.MicroserviceInstance)3 ArrayList (java.util.ArrayList)2 MicroserviceVersion (org.apache.servicecomb.registry.consumer.MicroserviceVersion)2 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Mock (mockit.Mock)1 MockUp (mockit.MockUp)1 EnvironmentConfiguration (org.apache.commons.configuration.EnvironmentConfiguration)1 DiscoveryManager (org.apache.servicecomb.registry.DiscoveryManager)1 FindInstancesResponse (org.apache.servicecomb.registry.api.registry.FindInstancesResponse)1 MicroserviceInstances (org.apache.servicecomb.registry.api.registry.MicroserviceInstances)1 AppManager (org.apache.servicecomb.registry.consumer.AppManager)1 MicroserviceVersionRule (org.apache.servicecomb.registry.consumer.MicroserviceVersionRule)1 MicroserviceVersions (org.apache.servicecomb.registry.consumer.MicroserviceVersions)1