/**
   * Test {@link MultipartReplyTranslator#translate(SwitchConnectionDistinguisher, SessionContext,
   * OfHeader)} with empty queue stats
   */
  @Test
  public void testEmptyQueueStats() {
    MultipartReplyMessageBuilder mpBuilder = new MultipartReplyMessageBuilder();
    mpBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    mpBuilder.setXid(123L);
    mpBuilder.setFlags(new MultipartRequestFlags(false));
    mpBuilder.setType(MultipartType.OFPMPQUEUE);

    MultipartReplyQueueCaseBuilder caseBuilder = new MultipartReplyQueueCaseBuilder();
    MultipartReplyQueueBuilder statsBuilder = new MultipartReplyQueueBuilder();
    List<QueueStats> queueStats = new ArrayList<>();
    statsBuilder.setQueueStats(queueStats);
    caseBuilder.setMultipartReplyQueue(statsBuilder.build());
    mpBuilder.setMultipartReplyBody(caseBuilder.build());
    MultipartReplyMessage message = mpBuilder.build();

    List<DataObject> list = translator.translate(cookie, sc, message);

    Assert.assertEquals("Wrong list size", 1, list.size());
    QueueStatisticsUpdate statUpdate = (QueueStatisticsUpdate) list.get(0);
    Assert.assertEquals("Wrong node-id", "openflow:42", statUpdate.getId().getValue());
    Assert.assertEquals("Wrong more-replies", false, statUpdate.isMoreReplies());
    Assert.assertEquals(
        "Wrong transaction-id", 123, statUpdate.getTransactionId().getValue().intValue());
    Assert.assertEquals(
        "Wrong queue stats size", 0, statUpdate.getQueueIdAndStatisticsMap().size());
  }
  /**
   * Test {@link MultipartReplyTranslator#translate(SwitchConnectionDistinguisher, SessionContext,
   * OfHeader)} with queue stats
   */
  @Test
  public void testQueueStats() {
    MultipartReplyMessageBuilder mpBuilder = new MultipartReplyMessageBuilder();
    mpBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    mpBuilder.setXid(123L);
    mpBuilder.setFlags(new MultipartRequestFlags(false));
    mpBuilder.setType(MultipartType.OFPMPQUEUE);

    MultipartReplyQueueCaseBuilder caseBuilder = new MultipartReplyQueueCaseBuilder();
    MultipartReplyQueueBuilder statsBuilder = new MultipartReplyQueueBuilder();
    List<QueueStats> queueStats = new ArrayList<>();
    QueueStatsBuilder builder = new QueueStatsBuilder();
    builder.setPortNo(BinContent.intToUnsignedLong(PortNumberValues.FLOOD.getIntValue()));
    builder.setQueueId(2L);
    builder.setTxPackets(new BigInteger("3"));
    builder.setTxBytes(new BigInteger("4"));
    builder.setTxErrors(new BigInteger("5"));
    builder.setDurationSec(6L);
    builder.setDurationNsec(7L);
    queueStats.add(builder.build());
    builder = new QueueStatsBuilder();
    builder.setPortNo(BinContent.intToUnsignedLong(PortNumberValues.INPORT.getIntValue()));
    builder.setQueueId(20L);
    builder.setTxPackets(new BigInteger("30"));
    builder.setTxBytes(new BigInteger("40"));
    builder.setTxErrors(new BigInteger("50"));
    builder.setDurationSec(60L);
    builder.setDurationNsec(70L);
    queueStats.add(builder.build());
    statsBuilder.setQueueStats(queueStats);
    caseBuilder.setMultipartReplyQueue(statsBuilder.build());
    mpBuilder.setMultipartReplyBody(caseBuilder.build());
    MultipartReplyMessage message = mpBuilder.build();

    List<DataObject> list = translator.translate(cookie, sc, message);

    Assert.assertEquals("Wrong list size", 1, list.size());
    QueueStatisticsUpdate statUpdate = (QueueStatisticsUpdate) list.get(0);
    Assert.assertEquals("Wrong node-id", "openflow:42", statUpdate.getId().getValue());
    Assert.assertEquals("Wrong more-replies", false, statUpdate.isMoreReplies());
    Assert.assertEquals(
        "Wrong transaction-id", 123, statUpdate.getTransactionId().getValue().intValue());
    Assert.assertEquals(
        "Wrong queue stats size", 2, statUpdate.getQueueIdAndStatisticsMap().size());
    QueueIdAndStatisticsMap stat = statUpdate.getQueueIdAndStatisticsMap().get(0);
    Assert.assertEquals(
        "Wrong port number", "openflow:42:FLOOD", stat.getNodeConnectorId().getValue());
    Assert.assertEquals("Wrong queue-id", 2, stat.getQueueId().getValue().intValue());
    Assert.assertEquals("Wrong tx packets", 3, stat.getTransmittedPackets().getValue().intValue());
    Assert.assertEquals("Wrong tx bytes", 4, stat.getTransmittedBytes().getValue().intValue());
    Assert.assertEquals("Wrong tx errors", 5, stat.getTransmissionErrors().getValue().intValue());
    Assert.assertEquals(
        "Wrong duration sec", 6, stat.getDuration().getSecond().getValue().intValue());
    Assert.assertEquals(
        "Wrong duration n sec", 7, stat.getDuration().getNanosecond().getValue().intValue());
    stat = statUpdate.getQueueIdAndStatisticsMap().get(1);
    Assert.assertEquals(
        "Wrong port number", "openflow:42:INPORT", stat.getNodeConnectorId().getValue());
    Assert.assertEquals("Wrong queue-id", 20, stat.getQueueId().getValue().intValue());
    Assert.assertEquals("Wrong tx packets", 30, stat.getTransmittedPackets().getValue().intValue());
    Assert.assertEquals("Wrong tx bytes", 40, stat.getTransmittedBytes().getValue().intValue());
    Assert.assertEquals("Wrong tx errors", 50, stat.getTransmissionErrors().getValue().intValue());
    Assert.assertEquals(
        "Wrong duration sec", 60, stat.getDuration().getSecond().getValue().intValue());
    Assert.assertEquals(
        "Wrong duration n sec", 70, stat.getDuration().getNanosecond().getValue().intValue());
  }