/**
   * Test method for {@link
   * org.opendaylight.openflowplugin.openflow.md.core.MDController#addMessageListeners} .
   */
  @Test
  public void testAddMessageListeners() {
    // clean translators
    controller.getMessageTranslators().clear();

    // Empty map
    int size = controller.getMessageTranslators().size();
    Assert.assertEquals(0, size);
    // Add one
    IMDMessageTranslator<OfHeader, List<DataObject>> objDps = new DataPacketService();
    controller.addMessageTranslator(PacketIn.class, 4, objDps);
    size = controller.getMessageTranslators().size();
    Assert.assertEquals(1, size);
    // Remove one
    controller.removeMessageTranslator(PacketIn.class, 4, objDps);
    size = controller.getMessageTranslators().size();
    Assert.assertEquals(0, size);
    // Add two and remove One
    IMDMessageTranslator objFps = new FlowProgrammerService();
    controller.addMessageTranslator(PacketIn.class, 4, objDps);
    controller.addMessageTranslator(FlowRemoved.class, 4, objFps);
    controller.removeMessageTranslator(FlowRemoved.class, 4, objFps);
    size = controller.getMessageTranslators().size();
    Assert.assertEquals(1, size);
    // Add one more and remove both
    controller.addMessageTranslator(FlowRemoved.class, 4, objFps);
    controller.removeMessageTranslator(PacketIn.class, 4, objDps);
    controller.removeMessageTranslator(FlowRemoved.class, 4, objFps);
    size = controller.getMessageTranslators().size();
    Assert.assertEquals(0, size);
    // Add multiple listeners to messageTypes
    controller.addMessageTranslator(PacketIn.class, 4, objDps);
    controller.addMessageTranslator(PacketIn.class, 4, objFps); // Duplicate value entry
    controller.addMessageTranslator(FlowRemoved.class, 4, objFps);
    size = controller.getMessageTranslators().size();
    Assert.assertEquals(2, size);
    // Remove one of the multiple listener, still size remains same
    controller.removeMessageTranslator(PacketIn.class, 4, objFps);
    size = controller.getMessageTranslators().size();
    Assert.assertEquals(2, size);
  }
 /** @throws java.lang.Exception */
 @Before
 public void setUp() throws Exception {
   controller = new MDController();
   controller.init();
 }