@Override
    public ObjectNode encode(MaintenanceDomain md, CodecContext context) {
        checkNotNull(md, "Maintenance Domain cannot be null");
        ObjectNode result = context.mapper().createObjectNode()
                .put(MD_NAME, md.mdId().toString())
                .put(MD_NAME_TYPE, md.mdId().nameType().name())
                .put(MD_LEVEL, md.mdLevel().name());
        if (md.mdNumericId() > 0) {
            result = result.put(MD_NUMERIC_ID, md.mdNumericId());
        }
        result.set("maList",
                new MaintenanceAssociationCodec()
                .encode(md.maintenanceAssociationList(), context));

        return result;
    }
@Test
    public void testEncodeMd1() throws CfmConfigException {
        MaintenanceDomain md1 = DefaultMaintenanceDomain.builder(MDID1_CHAR)
                .mdLevel(MaintenanceDomain.MdLevel.LEVEL1)
                .mdNumericId((short) 1)
                .build();

        ObjectNode node = mapper.createObjectNode();
        node.set("md", context.codec(MaintenanceDomain.class).encode(md1, context));

        assertEquals("{\"md\":{" +
                "\"mdName\":\"test-1\"," +
                "\"mdNameType\":\"CHARACTERSTRING\"," +
                "\"mdLevel\":\"LEVEL1\"," +
                "\"mdNumericId\":1," +
                "\"maList\":[]}}", node.toString());
    }