@Override
    public ObjectNode encode(RemoteMepEntry remoteMepEntry, CodecContext context) {
        checkNotNull(remoteMepEntry, "Mep cannot be null");
        ObjectNode result = context.mapper().createObjectNode()
                .put("remoteMepId", remoteMepEntry.remoteMepId().toString())
                .put("remoteMepState", remoteMepEntry.state().name())
                .put("rdi", remoteMepEntry.rdi());

        if (remoteMepEntry.failedOrOkTime() != null) {
            result = result.put("failedOrOkTime",
                    remoteMepEntry.failedOrOkTime().toString());
        }

        if (remoteMepEntry.macAddress() != null) {
            result = result.put("macAddress", remoteMepEntry.macAddress().toString());
        }

        if (remoteMepEntry.portStatusTlvType() != null) {
            result = result.put("portStatusTlvType",
                    remoteMepEntry.portStatusTlvType().name());
        }
        if (remoteMepEntry.interfaceStatusTlvType() != null) {
            result = result.put("interfaceStatusTlvType",
                    remoteMepEntry.interfaceStatusTlvType().name());
        }
        if (remoteMepEntry.senderIdTlvType() != null) {
            result = result.put("senderIdTlvType",
                    remoteMepEntry.senderIdTlvType().name());
        }

        return result;
    }
@Test
    public void testEncodeRemoteMepEntryCodecContext() {
        ObjectNode node = mapper.createObjectNode();
        node.set("remoteMep", context.codec(RemoteMepEntry.class)
                .encode(remoteMep1, context));

        assertEquals(10, node.get("remoteMep").get("remoteMepId").asInt());
    }