SdxParticipantsConfig extends Config<ApplicationId> { public PeerConfig getPeerForName(Optional<String> peerName) { Optional<PeerConfig> match = bgpPeers() .stream() .filter(p -> p.name().equals(peerName)) .findAny(); if (match.isPresent()) { return match.get(); } else { return null; } }  Set<PeerConfig> bgpPeers(); ConnectPoint getPortForPeer(IpAddress peerAddress); String getInterfaceNameForPeer(IpAddress peerAddress); PeerConfig getPeerForName(Optional<String> peerName); void addPeer(PeerConfig peer); PeerConfig getPeerForIp(IpAddress ip); void removePeer(IpAddress peerIp); static final String PEERS; static final String NAME; static final String IP; static final String CONN_POINT; static final String INTF_NAME; }
@Test public void testGetPeerForName() throws Exception { assertEquals(peer1, peersConfig.getPeerForName(Optional.of(NAME1))); }