diff --git a/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java b/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java
index cb446b2a9ec19cd46d59620e8b160e5e1ef3f4a7..037e816897b7a080212a89803cadf6485d4da659 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/RoleChangerTest.java
@@ -390,6 +390,19 @@ public class RoleChangerTest {
                 roleChanger.checkFirstPendingRoleRequestXid(sw, xid));
     }
     
+    @Test
+    public void testCheckFirstPendingRoleRequestNullSw() {
+        int xid = 54321;
+        long cookie = 232323;
+        Role role = Role.MASTER;
+        OFSwitchImpl sw = new OFSwitchImpl();
+        setupPendingRoleRequest(sw, xid, role, cookie);
+        // pass null as sw object, which is true during handshake
+        assertEquals(false,
+                roleChanger.checkFirstPendingRoleRequestXid(null, xid));
+        roleChanger.pendingRequestMap.get(sw).clear();
+    }
+    
     @Test
     public void testCheckFirstPendingRoleRequestCookie() {
         int xid = 54321;