protected Set<MessageOutput> getMessageOutputsForStream(Stream stream) {
        Set<MessageOutput> result = new HashSet<>();
        for (Output output : stream.getOutputs()) {
            final MessageOutput messageOutput = outputRegistry.getOutputForIdAndStream(output.getId(), stream);
            if (messageOutput != null) {
                result.add(messageOutput);
            }
        }

        return result;
    }
@Test
    public void testGetMessageOutputsForStreamWithTwoOutputs() throws Exception {
        final Stream stream = mock(Stream.class);
        final Output output1 = mock(Output.class);
        final Output output2 = mock(Output.class);
        final String output1Id = "foo";
        final String output2Id = "bar";
        final MessageOutput messageOutput1 = mock(MessageOutput.class);
        final MessageOutput messageOutput2 = mock(MessageOutput.class);
        final Set<Output> outputSet = ImmutableSet.of(output1, output2);
        when(stream.getOutputs()).thenReturn(outputSet);
        when(output1.getId()).thenReturn(output1Id);
        when(output2.getId()).thenReturn(output2Id);
        when(outputRegistry.getOutputForIdAndStream(eq(output1Id), eq(stream))).thenReturn(messageOutput1);
        when(outputRegistry.getOutputForIdAndStream(eq(output2Id), eq(stream))).thenReturn(messageOutput2);
        final OutputRouter outputRouter = new OutputRouter(defaultMessageOutput, outputRegistry);

        final Collection<MessageOutput> messageOutputs = outputRouter.getMessageOutputsForStream(stream);

        assertEquals(2, messageOutputs.size());
        assertTrue(messageOutputs.contains(messageOutput1));
        assertTrue(messageOutputs.contains(messageOutput2));
    }