@Override
    public ObjectNode encode(MaintenanceAssociation ma, CodecContext context) {
        checkNotNull(ma, "Maintenance Association cannot be null");
        ObjectNode result = context.mapper().createObjectNode()
                .put(MA_NAME, ma.maId().toString())
                .put(MA_NAME_TYPE, ma.maId().nameType().name());
        if (ma.maNumericId() > 0) {
            result = result.put(MA_NUMERIC_ID, ma.maNumericId());
        }
        if (ma.ccmInterval() != null) {
            result = result.put(CCM_INTERVAL, ma.ccmInterval().name());
        }

        result.set(COMPONENT_LIST, new ComponentCodec().encode(ma.componentList(), context));
        result.set(RMEP_LIST, new RMepCodec().encode(ma.remoteMepIdList(), context));

        return result;
    }
@Test
    public void testEncodeMa3() throws CfmConfigException {
        MaintenanceAssociation ma1 = DefaultMaintenanceAssociation.builder(MAID3_OCTET, 10)
                .maNumericId((short) 3)
                .build();

        ObjectNode node = mapper.createObjectNode();
        node.set("ma", context.codec(MaintenanceAssociation.class).encode(ma1, context));

        assertEquals("{\"ma\":{" +
                "\"maName\":\"12467\"," +
                "\"maNameType\":\"TWOOCTET\"," +
                "\"maNumericId\":3," +
                "\"component-list\":[]," +
                "\"rmep-list\":[]}}", node.toString());
    }