@Override
    public ObjectNode encode(Load load, CodecContext context) {
        checkNotNull(load, "Load cannot be null");
        return context.mapper().createObjectNode()
                .put(RATE, load.rate())
                .put(LATEST, load.latest())
                .put(VALID, load.isValid())
                .put(TIME, load.time());
    }
@Test
    public void testLoadEncode() {
        final long startTime = System.currentTimeMillis();
        final Load load = new DefaultLoad(20, 10, 1);
        final JsonNode node = new LoadCodec()
                .encode(load, new MockCodecContext());
        assertThat(node.get("valid").asBoolean(), is(true));
        assertThat(node.get("latest").asLong(), is(20L));
        assertThat(node.get("rate").asLong(), is(10L));
        assertThat(node.get("time").asLong(), greaterThanOrEqualTo(startTime));
    }