### Question:
AvailableComponentPool { public ComponentConfiguration getAvailableComponent() { return Iterables.tryFind(components, IS_AVAILABLE).orNull(); } AvailableComponentPool();  AvailableComponentPool(List<ComponentConfiguration> configurations, List<ConnectionConfiguration> connections); void addComponents(List<ComponentConfiguration> configurations); void addConnections(List<ConnectionConfiguration> configurations); ComponentConfiguration getAvailableComponent(); Map<String, Stream> getAvailableInputStreams(ComponentConfiguration component); void registerBuildedComponent(Component component, ComponentConfiguration configuration); boolean isEmpty();  }### Answer:
@Test public void should_retrieve_available_component() { ComponentConfiguration configuration = createComponentConfiguration(); List<ComponentConfiguration> configurations = asList(configuration); AvailableComponentPool pool = new AvailableComponentPool(configurations, new ArrayList<ConnectionConfiguration>()); ComponentConfiguration actualComponent = pool.getAvailableComponent(); assertThat(actualComponent).isEqualTo(configuration); }
@Test public void should_not_retrieve_not_available_component() { ComponentConfiguration configuration = createComponentConfigurationWithInputStreams(); ConnectionConfiguration connection1 = new ConnectionConfiguration("", "", configuration.getId(), "in1"); ConnectionConfiguration connection2 = new ConnectionConfiguration("", "", configuration.getId(), "in2"); AvailableComponentPool pool = new AvailableComponentPool(asList(configuration), asList(connection1, connection2)); ComponentConfiguration actualComponent = pool.getAvailableComponent(); assertThat(actualComponent).isNull(); }