### Question:
KubernetesQuery { @CheckForNull public Integer getFirstNodePortByServiceName(String name) { List<ServicePort> ports = client.services().withName(name).get().getSpec().getPorts(); if (ports.size() == 0) return null; else return ports.get(0).getNodePort(); } KubernetesQuery(KubernetesClient client); @CheckForNull Integer getFirstNodePortByServiceName(String name);  }### Answer:
@Test public void testGetFirstNodePortByServiceName() { KubernetesClient client = k.getClient(); Service svc = new ServiceBuilder() .withNewMetadata() .withName("kafka-svc") .endMetadata() .withNewSpec() .withType("NodePort") .addNewPort() .withNodePort(31234) .endPort() .endSpec() .build(); client.services().create(svc); KubernetesQuery query = new KubernetesQuery(client); assertThat(query.getFirstNodePortByServiceName("kafka-svc"), is(31234)); }