@Test public void hasDescriptorWhenInCacheTest() throws Exception { DocumentReference user = new DocumentReference("xwiki", "XWiki", "UserA"); when(wikiDescriptorManager.getMainWikiId()).thenReturn("xwiki"); ExecutionContext executionContext = new ExecutionContext(); when(execution.getContext()).thenReturn(executionContext); RecordableEventDescriptor descriptor1 = mock(RecordableEventDescriptor.class); RecordableEventDescriptor descriptor2 = mock(RecordableEventDescriptor.class); when(descriptor2.getEventType()).thenReturn("eventType"); executionContext.setProperty("RecordableEventDescriptorHelperCache_xwiki:XWiki.UserA", Arrays.asList(descriptor1, descriptor2)); assertTrue(mocker.getComponentUnderTest().hasDescriptor("eventType", user)); verifyZeroInteractions(recordableEventDescriptorManager); }
public boolean hasDescriptor(String eventType, DocumentReference user) throws EventStreamException { return getRecordableEventDescriptor(user).stream() .anyMatch(descriptor -> StringUtils.equals(eventType, descriptor.getEventType())); }
RecordableEventDescriptorHelper { public boolean hasDescriptor(String eventType, DocumentReference user) throws EventStreamException { return getRecordableEventDescriptor(user).stream() .anyMatch(descriptor -> StringUtils.equals(eventType, descriptor.getEventType())); } }
RecordableEventDescriptorHelper { public boolean hasDescriptor(String eventType, DocumentReference user) throws EventStreamException { return getRecordableEventDescriptor(user).stream() .anyMatch(descriptor -> StringUtils.equals(eventType, descriptor.getEventType())); }  }
RecordableEventDescriptorHelper { public boolean hasDescriptor(String eventType, DocumentReference user) throws EventStreamException { return getRecordableEventDescriptor(user).stream() .anyMatch(descriptor -> StringUtils.equals(eventType, descriptor.getEventType())); }  boolean hasDescriptor(String eventType, DocumentReference user); }
RecordableEventDescriptorHelper { public boolean hasDescriptor(String eventType, DocumentReference user) throws EventStreamException { return getRecordableEventDescriptor(user).stream() .anyMatch(descriptor -> StringUtils.equals(eventType, descriptor.getEventType())); }  boolean hasDescriptor(String eventType, DocumentReference user);  }