use of io.servicecomb.serviceregistry.cache.CacheEndpoint in project java-chassis by ServiceComb.
the class TestIpPortManager method testNextAddressesSize.
@Test
public void testNextAddressesSize() {
new MockUp<IpPortManager>() {
@Mock
public List<CacheEndpoint> getAddressCaches() {
List<CacheEndpoint> addressCaches = new ArrayList<>();
addressCaches.add(new CacheEndpoint("http://127.0.0.3:8080", null));
addressCaches.add(new CacheEndpoint("http://127.0.0.3:8080", null));
return addressCaches;
}
};
Map<Integer, Boolean> addressCanUsed = new HashMap<Integer, Boolean>();
addressCanUsed.get(0);
addressCanUsed.put(0, true);
Deencapsulation.setField(manager, "addressCanUsed", addressCanUsed);
Assert.assertEquals(manager.next().getHostOrIp(), "127.0.0.3");
}
Aggregations