@Test
public void testRoleSetting() {

    agent.addConnectedSwitch(dpid2, switch2);
    // check that state can be changed for a connected switch
    assertThat(switch2.getRole(), is(RoleState.MASTER));
    controller.setRole(dpid2, RoleState.EQUAL);
    assertThat(switch2.getRole(), is(RoleState.EQUAL));
    // check that changing state on an unconnected switch does not crash
    controller.setRole(dpid3, RoleState.SLAVE);
}