@Override
    public ObjectNode encode(MastershipRole mastershipRole, CodecContext context) {
        checkNotNull(mastershipRole, "MastershipRole cannot be null");
        ObjectNode result = context.mapper().createObjectNode()
                .put(ROLE, mastershipRole.name());
        return result;
    }
@Test
    public void testMastershipRoleEncode() {
        MastershipRole mastershipRole = MASTER;
        ObjectNode mastershipRoleJson = mastershipRoleCodec.encode(mastershipRole, context);
        assertThat(mastershipRoleJson, MastershipRoleJsonMatcher.matchesMastershipRole(mastershipRole));
    }