use of io.gravitee.definition.model.EndpointGroup in project gravitee-management-rest-api by gravitee-io.
the class ApiService_hasHealthCheckEnabledTest method mockProxy.
private void mockProxy(final ApiEntity api, final boolean withHC) {
final Proxy proxy = mock(Proxy.class);
when(api.getProxy()).thenReturn(proxy);
final EndpointGroup endpointGroup = mock(EndpointGroup.class);
when(proxy.getGroups()).thenReturn(Collections.singleton(endpointGroup));
final HttpEndpoint endpoint1 = mock(HttpEndpoint.class);
final HttpEndpoint endpoint2 = mock(HttpEndpoint.class);
when(endpointGroup.getEndpoints()).thenReturn(new HashSet<>(Arrays.asList(endpoint1, endpoint2)));
final EndpointHealthCheckService endpointHealthCheckService1 = mock(EndpointHealthCheckService.class);
when(endpoint1.getHealthCheck()).thenReturn(endpointHealthCheckService1);
when(endpointHealthCheckService1.isEnabled()).thenReturn(true);
final EndpointHealthCheckService endpointHealthCheckService2 = mock(EndpointHealthCheckService.class);
when(endpoint2.getHealthCheck()).thenReturn(endpointHealthCheckService2);
when(endpointHealthCheckService2.isEnabled()).thenReturn(withHC);
}
Aggregations