### Question:
NodeInfo { public Map<ServiceType, Integer> services() { return directServices; } @JsonCreator  NodeInfo(
        @JsonProperty("couchApiBase") String viewUri,
        @JsonProperty("hostname") String hostname,
        @JsonProperty("ports") Map<String, Integer> ports,
        @JsonProperty("alternateAddresses") Map<String, AlternateAddress> alternateAddresses);  NodeInfo(String hostname, Map<ServiceType, Integer> direct,
                    Map<ServiceType, Integer> ssl, Map<String, AlternateAddress> alternateAddresses); String hostname(); NodeIdentifier identifier(); Map<ServiceType, Integer> services(); Map<ServiceType, Integer> sslServices(); Map<String, AlternateAddress> alternateAddresses(); @Override String toString();  }### Answer:
@Test void shouldExposeViewServiceWhenAvailable() { Map<String, Integer> ports = new HashMap<>(); String viewBase = "http: NodeInfo info = new NodeInfo(viewBase, "localhost:8091", ports, null); assertEquals(2, info.services().size()); assertEquals(8091, (long) info.services().get(ServiceType.MANAGER)); assertEquals(8092, (long) info.services().get(ServiceType.VIEWS)); }
@Test void shouldNotExposeViewServiceWhenNotAvailable() { Map<String, Integer> ports = new HashMap<>(); NodeInfo info = new NodeInfo(null, "localhost:8091", ports, null); assertEquals(1, info.services().size()); assertEquals(8091, (long) info.services().get(ServiceType.MANAGER)); }