@Test
public void testGetActiveSwitch() {

    MockOFConnection connection = new MockOFConnection(DATAPATH_ID_1, OFAuxId.MAIN);
    IOFSwitchBackend sw = new MockOFSwitchImpl(connection);
    sw.setStatus(SwitchStatus.HANDSHAKE);
    assertNull(switchManager.getActiveSwitch(DATAPATH_ID_1));
    switchManager.switchAdded(sw);
    assertNull(switchManager.getActiveSwitch(DATAPATH_ID_1));
    sw.setStatus(SwitchStatus.MASTER);
    assertEquals(sw, switchManager.getActiveSwitch(DATAPATH_ID_1));
    sw.setStatus(SwitchStatus.QUARANTINED);
    assertNull(switchManager.getActiveSwitch(DATAPATH_ID_1));
    sw.setStatus(SwitchStatus.SLAVE);
    assertEquals(sw, switchManager.getActiveSwitch(DATAPATH_ID_1));
    sw.setStatus(SwitchStatus.DISCONNECTED);
    assertNull(switchManager.getActiveSwitch(DATAPATH_ID_1));
    // we don't care for updates. drain queue.
    controller.processUpdateQueueForTesting();
}