### Question:
EnvironmentImpl implements Environment { @Override public List<ComponentGroup> findGroupsWithIp(String ip) { return filter(groups, g -> g.getIp().filter(ip::equals).isPresent()); }  @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 filterGroupsByIp() { String ip = "127.0.0.1"; when(group2.getIp()).thenReturn(of(ip)); assertEquals(singletonList(group2), env.findGroupsWithIp(ip)); assertEquals(emptyList(), env.findGroupsWithIp("badIp")); }