PolicyWorkerQueue { public PolicyWorkerQueue() { workers = new ArrayList<>(); } PolicyWorkerQueue();  PolicyWorkerQueue(List<WorkSlot> workers);  PolicyWorkerQueue(StreamPartition partition, List<WorkSlot> workers); StreamPartition getPartition(); void setPartition(StreamPartition partition); List<WorkSlot> getWorkers(); void setWorkers(List<WorkSlot> workers); @Override boolean equals(Object other); @Override int hashCode(); String toString();  }
@Test public void testPolicyWorkerQueue() { List<WorkSlot> workers = new ArrayList<>(); WorkSlot workSlot1 = new WorkSlot("setTopologyName1", "setBoltId1"); WorkSlot workSlot2 = new WorkSlot("setTopologyName1", "setBoltId2"); workers.add(workSlot1); workers.add(workSlot2); PolicyWorkerQueue policyWorkerQueue = new PolicyWorkerQueue(workers); Assert.assertEquals(null, policyWorkerQueue.getPartition()); Assert.assertEquals(workSlot1, policyWorkerQueue.getWorkers().get(0)); Assert.assertEquals(workSlot2, policyWorkerQueue.getWorkers().get(1)); Assert.assertEquals("[(setTopologyName1:setBoltId1),(setTopologyName1:setBoltId2)]", policyWorkerQueue.toString()); PolicyWorkerQueue policyWorkerQueue1 = new PolicyWorkerQueue(); policyWorkerQueue1.setWorkers(workers); Assert.assertTrue(policyWorkerQueue.equals(policyWorkerQueue1)); Assert.assertTrue(policyWorkerQueue.hashCode() == policyWorkerQueue1.hashCode()); StreamSortSpec streamSortSpec = new StreamSortSpec(); streamSortSpec.setWindowPeriod("PT10S"); StreamPartition streamPartition = new StreamPartition(); List<String> columns = new ArrayList<>(); columns.add("jobId"); streamPartition.setColumns(columns); streamPartition.setSortSpec(streamSortSpec); streamPartition.setStreamId("test"); streamPartition.setType(StreamPartition.Type.GROUPBY); policyWorkerQueue1.setPartition(streamPartition); Assert.assertFalse(policyWorkerQueue.equals(policyWorkerQueue1)); Assert.assertFalse(policyWorkerQueue.hashCode() == policyWorkerQueue1.hashCode()); }