### Question:
DestinationMapperUtils { List<Subnet> getLocalSubnets(NodeId nodeId) { Collection<Endpoint> endpointsForNode = ctx.getEndpointManager().getEndpointsForNode(nodeId); List<Subnet> localSubnets = new ArrayList<>(); for (Endpoint endpoint : endpointsForNode) { HashSet<Subnet> subnets = getSubnets(endpoint.getTenant()); if (subnets.isEmpty()) { LOG.debug("No local subnets in tenant {} for EP {}.", endpoint.getTenant(), endpoint.getKey()); continue; } NetworkDomainId epNetworkContainment = getEPNetworkContainment(endpoint, ctx.getTenant(endpoint.getTenant())); for (Subnet subnet : subnets) { if (epNetworkContainment.getValue().equals(subnet.getId().getValue())) { localSubnets.add(subnet); } } } return localSubnets; } DestinationMapperUtils(OfContext ctx);   }### Answer:
@Test public void getLocalSubnets() { Collection<Endpoint> endpoints = new ArrayList<>(); EndpointBuilder epWithoutSubnet = buildEndpoint(IPV4_0, MAC_1, CONNECTOR_1); epWithoutSubnet.setTenant(null); EndpointBuilder epWithSubnet = buildEndpoint(IPV4_0, MAC_0, CONNECTOR_1); TenantBuilder tenantBuilder = new TenantBuilder(buildTenant().build()); Tenant tenant = tenantBuilder.build(); epWithSubnet.setTenant(tenant.getId()); epWithSubnet.setTenant(tenant.getId()); endpoints.add(epWithoutSubnet.build()); endpoints.add(epWithSubnet.build()); when(ctx.getEndpointManager()).thenReturn(endpointManager); when(ctx.getTenant(null)).thenReturn(null); when(ctx.getTenant(tenant.getId())).thenReturn(new IndexedTenant(tenant)); when(endpointManager.getEndpointsForNode(NODE_ID)).thenReturn(endpoints); List<Subnet> subnets = utils.getLocalSubnets(NODE_ID); verify(endpointManager, times(1)).getEndpointsForNode(any(NodeId.class)); assertTrue(subnets.size() == 1); }