### Question:
NeutronGbpIidFactory { public static InstanceIdentifier<ExternalGatewayAsEndpoint> externalGatewayAsEndpoint(ContextId contextId, IpPrefix ipPrefix, Class<? extends ContextType> contextType) { ExternalGatewayAsEndpointKey key = new ExternalGatewayAsEndpointKey( new String(ipPrefix.getValue()), IpPrefixType.class, contextId, contextType); return InstanceIdentifier.builder(Mappings.class) .child(NeutronByGbpMappings.class) .child(ExternalGatewaysAsEndpoints.class) .child(ExternalGatewayAsEndpoint.class, key) .build(); }  static InstanceIdentifier<BaseEndpointByPort> baseEndpointByPortIid(UniqueId portId); @Deprecated static InstanceIdentifier<EndpointByPort> endpointByPortIid(UniqueId portId); static InstanceIdentifier<PortByBaseEndpoint> portByBaseEndpointIid(PortByBaseEndpointKey baseEpkey); @Deprecated static InstanceIdentifier<PortByEndpoint> portByEndpointIid(L2BridgeDomainId l2BdId, MacAddress mac); static InstanceIdentifier<ExternalGatewayAsEndpoint> externalGatewayAsEndpoint(ContextId contextId,
            IpPrefix ipPrefix, Class<? extends ContextType> contextType); @Deprecated static InstanceIdentifier<ExternalGatewayAsL3Endpoint> externalGatewayAsL3Endpoint(L3ContextId l3Context,
            IpAddress ipAddress); static InstanceIdentifier<ProviderPhysicalNetworkAsL2FloodDomain> providerPhysicalNetworkAsL2FloodDomainIid(
            TenantId tenantId, ContextId domainId); @Deprecated @SuppressWarnings("checkstyle:LineLength") // Longer lines in this method are caused by long package names, // this will be removed when deprecated classes will be cleared. static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.provider.physical.networks.as.l2.flood.domains.ProviderPhysicalNetworkAsL2FloodDomain> providerPhysicalNetworkAsL2FloodDomainIid(
            TenantId tenantId, L2FloodDomainId l2FdId);  }### Answer:
@Test public void externalGatewayAsEndpointTest() { String ipAddress = "192.168.50.20/32"; IpPrefix ipPrefix = new IpPrefix(ipAddress.toCharArray()); ContextId ctxId = new ContextId("00000000-1111-2222-3333-44444555566667777"); InstanceIdentifier<ExternalGatewayAsEndpoint> id = NeutronGbpIidFactory.externalGatewayAsEndpoint(ctxId, ipPrefix, MappingUtils.L3_CONTEXT); assertNotNull(id); Class<?>[] expectedTypes = {Mappings.class, NeutronByGbpMappings.class, ExternalGatewaysAsEndpoints.class, ExternalGatewayAsEndpoint.class}; assertPathArgumentTypes(id.getPathArguments(), expectedTypes); assertEquals(ExternalGatewayAsEndpoint.class, id.getTargetType()); assertFalse(id.isWildcarded()); assertEquals(ctxId, id.firstKeyOf(ExternalGatewayAsEndpoint.class).getContextId()); assertEquals(MappingUtils.L3_CONTEXT, id.firstKeyOf(ExternalGatewayAsEndpoint.class).getContextType()); assertEquals(ipAddress, id.firstKeyOf(ExternalGatewayAsEndpoint.class).getAddress()); assertEquals(IpPrefixType.class, id.firstKeyOf(ExternalGatewayAsEndpoint.class).getAddressType()); }