### Question:
DestinationMapperUtils { Set<EndpointGroupId> getAllEndpointGroups(Endpoint endpoint) { Set<EndpointGroupId> groupIds = new HashSet<>(); if (endpoint.getEndpointGroup() != null) { groupIds.add(endpoint.getEndpointGroup()); } if (endpoint.getEndpointGroups() != null) { groupIds.addAll(endpoint.getEndpointGroups()); } return groupIds; } DestinationMapperUtils(OfContext ctx);   }### Answer:
@Test public void getAllEndpointGroups() { EndpointBuilder endpointBuilder = buildEndpoint(IPV4_0, MAC_0, CONNECTOR_0); endpointBuilder.setEndpointGroup(ENDPOINT_GROUP_0); List<EndpointGroupId> endpointGroups = new ArrayList<>(); EndpointGroupBuilder endpointGroupBuilder = new EndpointGroupBuilder(); endpointGroupBuilder.setId(ENDPOINT_GROUP_1); endpointGroups.add(endpointGroupBuilder.build().getId()); endpointBuilder.setEndpointGroups(endpointGroups); Set<EndpointGroupId> result = utils.getAllEndpointGroups(endpointBuilder.build()); assertTrue(result.size() == 2); }