Repository: microsoft/gctoolkit
File: IT/src/test/java/com/microsoft/gctoolkit/integration/CaptureJVMTerminationEventTest.java (Java)

Code before:
        gcToolKit.loadAggregationsFromServiceLoader();

        /**
         * The JavaVirtualMachine contains the aggregations as filled out by the Aggregators.
         * It also contains configuration information about how the JVM was configured for the runtime.
         */
        JavaVirtualMachine machine = null;
        JVMTerminationEventAggregation terminationAggregation = null;
        HeapOccupancyAfterCollectionSummary heapOccupancyAfterCollectionSummary = null;
        try {
            gcToolKit.loadAggregation(new JVMTerminationEventAggregation());
            machine = gcToolKit.analyze(logFile);
        } catch (IOException e) {
            fail(e.getMessage());
        }
        try {
            terminationAggregation = machine.getAggregation(JVMTerminationEventAggregation.class).get();
            heapOccupancyAfterCollectionSummary = machine.getAggregation(HeapOccupancyAfterCollectionSummary.class).get();
        } catch (Exception e) {
            fail(e.getMessage());
        }
        Assertions.assertEquals( 2.193d, terminationAggregation.getStartTime().getTimeStamp(),0.001d, "Time of first event");
        Assertions.assertEquals( 608800.088d, heapOccupancyAfterCollectionSummary.estimatedRuntime(),0.001d, "Runtime duration");

    }
    @Aggregates({EventSource.CMS_PREUNIFIED,EventSource.CMS_UNIFIED,EventSource.G1GC,EventSource.GENERATIONAL,EventSource.JVM,EventSource.SHENANDOAH, EventSource.TENURED,EventSource.ZGC})
    public static class JVMEventTerminationAggregator extends Aggregator<JVMTerminationEventAggregation> {

        public JVMEventTerminationAggregator(JVMTerminationEventAggregation aggregation) {
            super(aggregation);
            register(JVMTermination.class, this::process);
        }

        private void process(JVMTermination event) {
            aggregation().recordStartTime(event.getTimeOfFirstEvent());
        }
    }

    @Collates(JVMEventTerminationAggregator.class)
    public static class JVMTerminationEventAggregation extends Aggregation {

        DateTimeStamp startTime;

        public DateTimeStamp getStartTime() {
            return startTime;
        }

        public void recordStartTime(DateTimeStamp time) {
            startTime = time;
        }


Review comment (suggestion):
```suggestion
   
   @Aggregates({EventSource.CMS_PREUNIFIED,EventSource.CMS_UNIFIED,EventSource.G1GC,EventSource.GENERATIONAL,EventSource.JVM,EventSource.SHENANDOAH, EventSource.TENURED,EventSource.ZGC})
```

Code after:
        gcToolKit.loadAggregationsFromServiceLoader();

        /**
         * The JavaVirtualMachine contains the aggregations as filled out by the Aggregators.
         * It also contains configuration information about how the JVM was configured for the runtime.
         */
        JavaVirtualMachine machine = null;
        JVMTerminationEventAggregation terminationAggregation = null;
        HeapOccupancyAfterCollectionSummary heapOccupancyAfterCollectionSummary = null;
        try {
            gcToolKit.loadAggregation(new JVMTerminationEventAggregation());
            machine = gcToolKit.analyze(logFile);
        } catch (IOException e) {
            fail(e.getMessage());
        }
        try {
            terminationAggregation = machine.getAggregation(JVMTerminationEventAggregation.class).get();
            heapOccupancyAfterCollectionSummary = machine.getAggregation(HeapOccupancyAfterCollectionSummary.class).get();
        } catch (Exception e) {
            fail(e.getMessage());
        }
        Assertions.assertEquals( 2.193d, terminationAggregation.getStartTime().getTimeStamp(),0.001d, "Time of first event");
        Assertions.assertEquals( 608800.088d, heapOccupancyAfterCollectionSummary.estimatedRuntime(),0.001d, "Runtime duration");

    }
   
   @Aggregates({EventSource.CMS_PREUNIFIED,EventSource.CMS_UNIFIED,EventSource.G1GC,EventSource.GENERATIONAL,EventSource.JVM,EventSource.SHENANDOAH, EventSource.TENURED,EventSource.ZGC})
    public static class JVMEventTerminationAggregator extends Aggregator<JVMTerminationEventAggregation> {

        public JVMEventTerminationAggregator(JVMTerminationEventAggregation aggregation) {
            super(aggregation);
            register(JVMTermination.class, this::process);
        }

        private void process(JVMTermination event) {
            aggregation().recordStartTime(event.getTimeOfFirstEvent());
        }
    }

    @Collates(JVMEventTerminationAggregator.class)
    public static class JVMTerminationEventAggregation extends Aggregation {

        DateTimeStamp startTime;

        public DateTimeStamp getStartTime() {
            return startTime;
        }

        public void recordStartTime(DateTimeStamp time) {
            startTime = time;
        }