@Test public void getRecordableEventDescriptorsForEventType() throws Exception { RecordableEventDescriptor descriptorWiki1_1 = mock(RecordableEventDescriptor.class); RecordableEventDescriptor descriptorWiki1_2 = mock(RecordableEventDescriptor.class); when(contextComponentManager.getInstanceList(RecordableEventDescriptor.class)).thenReturn( Arrays.asList(descriptorWiki1_1, descriptorWiki1_2)); when(wikiDescriptorManager.getCurrentWikiId()).thenReturn("wiki1"); when(descriptorWiki1_1.isEnabled("wiki1")).thenReturn(true); when(descriptorWiki1_2.isEnabled("wiki1")).thenReturn(true); when(descriptorWiki1_1.getEventType()).thenReturn("type1"); when(descriptorWiki1_2.getEventType()).thenReturn("someType"); RecordableEventDescriptor result = mocker.getComponentUnderTest().getDescriptorForEventType("someType", false); assertNotNull(result); assertEquals(descriptorWiki1_2, result); assertNull(mocker.getComponentUnderTest().getDescriptorForEventType("unknowType", false)); }
@Override public RecordableEventDescriptor getDescriptorForEventType(String eventType, boolean allWikis) throws EventStreamException { return getRecordableEventDescriptors(allWikis).stream().filter(descriptor -> eventType.equals(descriptor.getEventType())).findAny().orElse(null); }
DefaultRecordableEventDescriptorManager implements RecordableEventDescriptorManager { @Override public RecordableEventDescriptor getDescriptorForEventType(String eventType, boolean allWikis) throws EventStreamException { return getRecordableEventDescriptors(allWikis).stream().filter(descriptor -> eventType.equals(descriptor.getEventType())).findAny().orElse(null); } }
DefaultRecordableEventDescriptorManager implements RecordableEventDescriptorManager { @Override public RecordableEventDescriptor getDescriptorForEventType(String eventType, boolean allWikis) throws EventStreamException { return getRecordableEventDescriptors(allWikis).stream().filter(descriptor -> eventType.equals(descriptor.getEventType())).findAny().orElse(null); }  }
DefaultRecordableEventDescriptorManager implements RecordableEventDescriptorManager { @Override public RecordableEventDescriptor getDescriptorForEventType(String eventType, boolean allWikis) throws EventStreamException { return getRecordableEventDescriptors(allWikis).stream().filter(descriptor -> eventType.equals(descriptor.getEventType())).findAny().orElse(null); }  @Override List<RecordableEventDescriptor> getRecordableEventDescriptors(boolean allWikis); @Override RecordableEventDescriptor getDescriptorForEventType(String eventType, boolean allWikis); }
DefaultRecordableEventDescriptorManager implements RecordableEventDescriptorManager { @Override public RecordableEventDescriptor getDescriptorForEventType(String eventType, boolean allWikis) throws EventStreamException { return getRecordableEventDescriptors(allWikis).stream().filter(descriptor -> eventType.equals(descriptor.getEventType())).findAny().orElse(null); }  @Override List<RecordableEventDescriptor> getRecordableEventDescriptors(boolean allWikis); @Override RecordableEventDescriptor getDescriptorForEventType(String eventType, boolean allWikis);  }