@Test public void testPartitionedEvent() { PartitionedEvent partitionedEvent = new PartitionedEvent(); Assert.assertEquals("PartitionedEvent[partition=null,event=null,key=0", partitionedEvent.toString()); Object[] data = new Object[]{"namevalue", "hostvalue", "1", 10, 0.1, -0.2, "{\"name\":\"heap.COMMITTED\", \"Value\":\"175636480\"}", 1}; StreamEvent streamEvent = new StreamEvent("streamId", 1478667686971l, data); 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); partitionedEvent = new PartitionedEvent(streamEvent, streamPartition, 1); Assert.assertEquals("PartitionedEvent[partition=StreamPartition[streamId=test,type=GROUPBY,columns=[jobId],sortSpec=[StreamSortSpec[windowPeriod=PT10S,windowMargin=30000]]],event=StreamEvent[stream=STREAMID,timestamp=2016-11-09 05:01:26,971,data=[namevalue,hostvalue,1,10,0.1,-0.2,{\"name\":\"heap.COMMITTED\", \"Value\":\"175636480\"},1],metaVersion=null],key=1", partitionedEvent.toString()); PartitionedEvent partitionedEventCopy = partitionedEvent.copy(); Assert.assertFalse(partitionedEventCopy == partitionedEvent); Assert.assertTrue(partitionedEventCopy.equals(partitionedEvent)); Assert.assertTrue(partitionedEventCopy.hashCode() == partitionedEvent.hashCode()); } }