@Override
    public ObjectNode encode(KubevirtFloatingIp fip, CodecContext context) {
        checkNotNull(fip, "Kubevirt floating IP cannot be null");

        ObjectNode result = context.mapper().createObjectNode()
                .put(ID, fip.id())
                .put(ROUTER_NAME, fip.routerName())
                .put(NETWORK_NAME, fip.networkName())
                .put(FLOATING_IP, fip.floatingIp().toString());

        if (fip.podName() != null) {
            result.put(POD_NAME, fip.podName());
        }

        if (fip.vmName() != null) {
            result.put(VM_NAME, fip.vmName());
        }

        if (fip.fixedIp() != null) {
            result.put(FIXED_IP, fip.fixedIp().toString());
        }

        return result;
    }
@Test
    public void testKubevirtFloatingIpEncode() {
        KubevirtFloatingIp floatingIp = DefaultKubevirtFloatingIp.builder()
                .id("fip-id")
                .routerName("router-1")
                .networkName("flat-1")
                .floatingIp(IpAddress.valueOf("10.10.10.10"))
                .podName("pod-1")
                .vmName("vm-1")
                .fixedIp(IpAddress.valueOf("20.20.20.20"))
                .build();

        ObjectNode floatingIpJson = kubevirtFloatingIpCodec.encode(floatingIp, context);
        assertThat(floatingIpJson, matchesKubevirtFloatingIp(floatingIp));
    }