### Question:
OvsdbConnectionManager implements OvsdbConnectionListener, AutoCloseable { public OvsdbConnectionInstance getConnectionInstance(final ConnectionInfo key) { ConnectionInfo connectionInfo = SouthboundMapper.suppressLocalIpPort(key); return clients.get(connectionInfo); } OvsdbConnectionManager(final DataBroker db,final TransactionInvoker txInvoker,
                                  final EntityOwnershipService entityOwnershipService,
                                  final OvsdbConnection ovsdbConnection,
                                  final InstanceIdentifierCodec instanceIdentifierCodec,
                                  final UpgradeState upgradeState); @Override void connected(final OvsdbClient externalClient); OvsdbConnectionInstance connectedButCallBacksNotRegistered(final OvsdbClient externalClient); @Override void disconnected(final OvsdbClient client); OvsdbClient connect(final InstanceIdentifier<Node> iid,
            final OvsdbNodeAugmentation ovsdbNode); void disconnect(final OvsdbNodeAugmentation ovsdbNode); @Override void close(); InstanceIdentifier<Node> getInstanceIdentifier(final ConnectionInfo key); OvsdbConnectionInstance getConnectionInstance(final ConnectionInfo key); OvsdbConnectionInstance getConnectionInstance(final OvsdbBridgeAttributes mn); OvsdbConnectionInstance getConnectionInstance(final Node node); OvsdbConnectionInstance getConnectionInstance(final InstanceIdentifier<Node> nodePath); OvsdbClient getClient(final ConnectionInfo connectionInfo); OvsdbClient getClient(final OvsdbBridgeAttributes mn); OvsdbClient getClient(final Node node); Boolean getHasDeviceOwnership(final ConnectionInfo connectionInfo); void reconcileConnection(final InstanceIdentifier<Node> iid, final OvsdbNodeAugmentation ovsdbNode); void stopConnectionReconciliationIfActive(final InstanceIdentifier<Node> iid,
            final OvsdbNodeAugmentation ovsdbNode); void stopBridgeConfigReconciliationIfActive(final InstanceIdentifier<Node> iid); void reconcileBridgeConfigurations(final OvsdbConnectionInstance client); Map<ConnectionInfo, OvsdbConnectionInstance> getClients();  }### Answer:
@Test @Ignore public void testInit() { mock(ConnectionInfo.class); suppress(MemberMatcher.method(OvsdbConnectionManager.class, "getConnectionInstance", ConnectionInfo.class)); OvsdbConnectionInstance ovsdbConnectionInstance = mock(OvsdbConnectionInstance.class); when(ovsdbConnManager.getConnectionInstance(any(ConnectionInfo.class))).thenReturn(ovsdbConnectionInstance); verify(ovsdbConnectionInstance).registerCallbacks(any()); }
@Test public void testPutAndGetConnectionInstance() throws Exception { ConnectionInfo key = mock(ConnectionInfo.class); ConnectionInfo connectionInfo = mock(ConnectionInfo.class); PowerMockito.mockStatic(SouthboundMapper.class); when(SouthboundMapper.suppressLocalIpPort(key)).thenReturn(connectionInfo); clients = new ConcurrentHashMap<>(); MemberModifier.field(OvsdbConnectionManager.class, "clients").set(ovsdbConnManager, clients); OvsdbConnectionInstance instance = mock(OvsdbConnectionInstance.class); Whitebox.invokeMethod(ovsdbConnManager, "putConnectionInstance", key, instance); Map<ConnectionInfo, OvsdbConnectionInstance> testClients = Whitebox.getInternalState(ovsdbConnManager, "clients"); assertEquals("Error, size of the hashmap is incorrect", 1, testClients.size()); assertEquals("Error, returned incorrect OvsdbConnectionInstance object", instance, ovsdbConnManager.getConnectionInstance(key)); }