use of org.apache.servicecomb.registry.discovery.DiscoveryFilter in project java-chassis by ServiceComb.
the class TestDiscoveryTree method discovery_filterReturnNull.
@Test
public void discovery_filterReturnNull(@Mocked InstanceCacheManager instanceCacheManager) {
new Expectations(DiscoveryManager.class) {
{
DiscoveryManager.INSTANCE.getInstanceCacheManager();
result = instanceCacheManager;
instanceCacheManager.getOrCreateVersionedCache(anyString, anyString, anyString);
result = parent;
}
};
DiscoveryFilter filter = new DiscoveryFilter() {
@Override
public int getOrder() {
return 0;
}
@Override
public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) {
return null;
}
};
discoveryTree.addFilter(filter);
expectedException.expect(ServiceCombException.class);
expectedException.expectMessage(Matchers.is(filter.getClass().getName() + " discovery return null."));
result = discoveryTree.discovery(context, null, null, null);
}
Aggregations