1 package org.onap.msb.apiroute.wrapper.consulextend.model.health;
3 import org.junit.Assert;
6 public class ServiceTest {
9 public void testImmutableService() {
10 ImmutableService service0 = ImmutableService.builder()
11 .id("huangleibo_id").port(0).address("").service("huangleibo")
12 .addTags("111", "222").createIndex(1).modifyIndex(1).build();
13 Assert.assertEquals("huangleibo_id", service0.getId());
14 Assert.assertEquals(1, service0.getCreateIndex());
15 Assert.assertEquals(1, service0.getModifyIndex());
17 ImmutableService service1 = service0.withId("huangleibo_id")
18 .withId("new_id").withService("huangleibo")
19 .withService("new_service").withTags("new_tags")
20 .withAddress("").withAddress("new_address").withPort(0)
21 .withPort(1).withCreateIndex(1).withCreateIndex(2)
22 .withModifyIndex(1).withModifyIndex(2);
24 Assert.assertFalse(service0.equals(service1));
26 System.out.println(service1.hashCode());
28 ImmutableService service2 = ImmutableService.builder().from(service1)
30 Assert.assertEquals("new_id", service2.getId());