### Question:
WorkerPorts { public boolean isValid() { Set<Integer> uniquePorts = new HashSet<>(); uniquePorts.add(metricsPort); uniquePorts.add(consolePort); uniquePorts.add(debugPort); uniquePorts.add(customPort); uniquePorts.add(sinkPort); return uniquePorts.size() >= 5 && isValidPort(metricsPort) && isValidPort(consolePort) && isValidPort(debugPort) && isValidPort(customPort) && isValidPort(sinkPort); } WorkerPorts(final List<Integer> assignedPorts);  WorkerPorts(int metricsPort, int debugPort, int consolePort, int customPort, int sinkPort); @JsonCreator @JsonIgnoreProperties(ignoreUnknown = true)  WorkerPorts(@JsonProperty("metricsPort") int metricsPort,
                       @JsonProperty("debugPort") int debugPort,
                       @JsonProperty("consolePort") int consolePort,
                       @JsonProperty("customPort") int customPort,
                       @JsonProperty("ports") List<Integer> ports); int getMetricsPort(); int getDebugPort(); int getConsolePort(); int getCustomPort(); int getSinkPort(); @JsonIgnore List<Integer> getAllPorts(); List<Integer> getPorts(); boolean isValid(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void shouldConstructValidWorkerPorts() { WorkerPorts workerPorts = new WorkerPorts(Arrays.asList(1, 2, 3, 4, 5)); assertTrue(workerPorts.isValid()); }