@Test
  public void testCborSerialize() throws Exception {
    CBORAccessRequestMac instance = new CBORAccessRequestMac(this.publisherId, this.ifMapTimestamp);

    CborBuilder cb = new CborBuilder();
    ArrayBuilder ab = cb.addArray();

    instance.cborSerialize(ab);

    ab.end();

    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    CborEncoder ce = new CborEncoder(bos);
    ce.encode(cb.build());

    log.info("CBOR serialize:");
    log.info(DatatypeConverter.printHexBinary(bos.toByteArray()));

    byte[] expResult =
        DatatypeConverter.parseHexBinary(
            "847839687474703A2F2F7777772E74727573746564636F6D707574696E6767726F75702E6F72672F32303130"
                + "2F49464D41504D455441444154412F32726163636573732D726571756573742D6D6163887269666D61702D7075626C69736865722D69646F6D792D7075626C6973"
                + "6865722D69646F69666D61702D74696D657374616D70C11A4ED9E8B2781869666D61702D74696D657374616D702D6672616374696F6EC482281A075BCA00716966"
                + "6D61702D63617264696E616C6974796B73696E676C6556616C756580");

    assertTrue(Arrays.equals(expResult, bos.toByteArray()));
  }
  @Override
  public void serializeAttributeGroup(
      final ArrayBuilder<?> builder, final DictionarySimpleElement elementEntry)
      throws CBORSerializationException {
    try {
      // Serialize 'session-id'
      {
        DataItem cborName =
            this.getAttributeNameMapping(SessionAttributeGroup.SESSION_ID, elementEntry);

        builder.add(cborName);
        builder.add(new UnicodeString(this.sessionId));
      }
    } catch (Exception ex) {
      throw new CBORSerializationException(
          "Error during serialization, see nested exception for details", ex);
    }
  }