### Question:
EnvironmentImpl implements Environment { @Override public Components findComponentsFrom(List<String> groups, List<String> componentNames) { List<Component> componentsFromGroups = componentsFrom(groups); List<Component> result = filterBy(componentNames, componentsFromGroups); info("Filtered " + result.size() + " component(s) in [" + name + "] env."); return new ComponentsImpl(result, propertiesFactory); }  @Override List<ComponentGroup> findGroupsWithIp(String ip); @Override ComponentGroup getGroupWithName(String groupName); @Override Optional<ComponentGroup> findGroupWithComponent(String componentName); @Override Components getAllComponents(); @Override Component getComponentWithName(String componentName); @Override Components findComponentsFrom(List<String> groups, List<String> componentNames); @Override Component findComponentWithName(String componentName); @Override String toString();  }### Answer:
@Test void findComponentsFrom() { assertEquals(components(one, two, three), env.findComponentsFrom(emptyList(), emptyList())); assertEquals(components(one, two, three), env.findComponentsFrom(asList("group1", "group2"), emptyList())); assertEquals(components(one, two), env.findComponentsFrom(asList("group1", "group2"), asList("one", "two"))); assertEquals(components(one, two), env.findComponentsFrom(singletonList("group1"), asList("one", "two"))); assertEquals(components(one, three), env.findComponentsFrom(emptyList(), asList("one", "three"))); assertThrows(IllegalArgumentException.class, () -> env.findComponentsFrom(singletonList("bad"), singletonList("bad"))); assertThrows(IllegalArgumentException.class, () -> env.findComponentsFrom(singletonList("bad"), emptyList())); assertThrows(NullPointerException.class, () -> env.findComponentsFrom(emptyList(), singletonList("bad"))); }