}).when(mockNotifier).addListener(anyObject(), any(CacheEventFilter.class), any(CacheEventConverter.class));
TestingUtil.replaceComponent(cache, CacheNotifier.class, mockNotifier, true);
}
protected void waitUntilNotificationRaised(final Cache<?, ?> cache, final CheckPoint checkPoint) {
CacheNotifier cn = TestingUtil.extractComponent(cache, CacheNotifier.class);
final Answer<Object> forwardedAnswer = AdditionalAnswers.delegatesTo(cn);
CacheNotifier mockNotifier = mock(CacheNotifier.class, withSettings().defaultAnswer(forwardedAnswer));
Answer answer = new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
// Wait for main thread to sync up
checkPoint.trigger("pre_raise_notification_invoked");