use of org.apache.sling.hc.junitbridge.HealthCheckTestsProvider in project sling by apache.
the class HealthCheckTestsProviderTest method setup.
@Before
public void setup() throws InvalidSyntaxException {
setupTimestamp = System.currentTimeMillis();
final ComponentContext ctx = Mockito.mock(ComponentContext.class);
// context properties
final Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(HealthCheckTestsProvider.PROP_TAG_GROUPS, TAG_GROUPS);
props.put(Constants.SERVICE_PID, getClass().getName());
Mockito.when(ctx.getProperties()).thenReturn(props);
// bundle context
final BundleContext bc = Mockito.mock(BundleContext.class);
Mockito.when(ctx.getBundleContext()).thenReturn(bc);
// HealthCheck ServiceReferences mocks
Mockito.when(bc.getServiceReferences(Mockito.anyString(), Mockito.anyString())).thenAnswer(new Answer<ServiceReference[]>() {
@Override
public ServiceReference[] answer(InvocationOnMock invocation) throws Throwable {
return getMockReferences(bc, (String) invocation.getArguments()[1]);
}
});
provider = new HealthCheckTestsProvider() {
{
activate(ctx);
}
};
}
Aggregations