### Question:
DestinationMapperUtils { NetworkDomainId getEPNetworkContainment(Endpoint endpoint, IndexedTenant tenant) { if (endpoint.getNetworkContainment() != null) { return endpoint.getNetworkContainment(); } else if (tenant != null) { return tenant.getEndpointGroup(endpoint.getEndpointGroup()) .getNetworkDomain(); } else { return null; } } DestinationMapperUtils(OfContext ctx);   }### Answer:
@Test public void getEpNetworkContainment_getNull() { EndpointBuilder endpointBuilder = buildEndpoint(IPV4_0, MAC_1, CONNECTOR_1); endpointBuilder.setNetworkContainment(null); NetworkDomainId result = utils.getEPNetworkContainment(endpointBuilder.build(), null); assertNull(result); }
@Test public void getEpNetworkContainment_getDomainIdFromEpg() { EndpointBuilder endpointBuilder = buildEndpoint(IPV4_0, MAC_1, CONNECTOR_1); endpointBuilder.setNetworkContainment(null); EndpointGroupBuilder endpointGroupBuilder = new EndpointGroupBuilder(); endpointGroupBuilder.setId(ENDPOINT_GROUP_0); endpointGroupBuilder.setNetworkDomain(new NetworkDomainId(NET_DOMAIN_ID)); endpointBuilder.setEndpointGroup(endpointGroupBuilder.build().getId()); NetworkDomainId result = utils.getEPNetworkContainment(endpointBuilder.build(), getTestIndexedTenant()); assertEquals(result, new SubnetId(SUBNET_0)); }
@Test public void getEpNetworkContainment_getDomainIdFromEndpoint() { String domainId = "domainId"; EndpointBuilder endpointBuilder = buildEndpoint(IPV4_0, MAC_1, CONNECTOR_1); endpointBuilder.setNetworkContainment(new NetworkDomainId(domainId)); NetworkDomainId result = utils.getEPNetworkContainment(endpointBuilder.build(), getTestIndexedTenant()); assertEquals(result, new NetworkDomainId(domainId)); }