@Override
    public ObjectNode encode(LispGcAddress address, CodecContext context) {
        checkNotNull(address, "LispGcAddress cannot be null");

        final ObjectNode result = context.mapper().createObjectNode()
                .put(NORTH, address.isNorth())
                .put(LATITUDE_DEGREE, address.getLatitudeDegree())
                .put(LATITUDE_MINUTE, address.getLatitudeMinute())
                .put(LATITUDE_SECOND, address.getLatitudeSecond())
                .put(EAST, address.isEast())
                .put(LONGITUDE_DEGREE, address.getLongitudeDegree())
                .put(LONGITUDE_MINUTE, address.getLongitudeMinute())
                .put(LONGITUDE_SECOND, address.getLongitudeSecond())
                .put(ALTITUDE, address.getAltitude());

        if (address.getAddress() != null) {
            final JsonCodec<MappingAddress> addressCodec =
                    context.codec(MappingAddress.class);
            ObjectNode addressNode = addressCodec.encode(address.getAddress(), context);
            result.set(ADDRESS, addressNode);
        }

        return result;
    }
@Test
    public void testLispGcAddressEncode() {
        LispGcAddress address = new LispGcAddress.Builder()
                .withIsNorth(NORTH)
                .withLatitudeDegree(LATITUDE_DEGREE)
                .withLatitudeMinute(LATITUDE_MINUTE)
                .withLatitudeSecond(LATITUDE_SECOND)
                .withIsEast(EAST)
                .withLongitudeDegree(LONGITUDE_DEGREE)
                .withLongitudeMinute(LONGITUDE_MINUTE)
                .withLongitudeSecond(LONGITUDE_SECOND)
                .withAltitude(ALTITUDE)
                .withAddress(MappingAddresses.ipv4MappingAddress(IPV4_PREFIX))
                .build();
        ObjectNode addressJson = gcAddressCodec.encode(address, context);
        assertThat("errors in encoding Geo Coordinate address JSON",
                addressJson, LispGcAddressJsonMatcher.matchesGcAddress(address));
    }