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

Code before:
package com.microsoft.gctoolkit.integration;

import com.microsoft.gctoolkit.GCToolKit;
import com.microsoft.gctoolkit.aggregator.Aggregates;
import com.microsoft.gctoolkit.aggregator.Aggregation;
import com.microsoft.gctoolkit.aggregator.Aggregator;
import com.microsoft.gctoolkit.aggregator.Collates;
import com.microsoft.gctoolkit.aggregator.EventSource;
import com.microsoft.gctoolkit.integration.io.TestLogFile;
import com.microsoft.gctoolkit.io.SingleGCLogFile;
import com.microsoft.gctoolkit.jvm.JavaVirtualMachine;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.fail;

@Tag("modulePath")
public class MissingAnnotationTest {

    @SuppressWarnings("unchecked")
    private void workFlow( Aggregation aggregation, Class clazz) {
        GCToolKit gcToolKit = new GCToolKit();
        // Load our test aggregation instead of calling GCToolKit::loadAggregationsFromServiceLoader
        gcToolKit.loadAggregation(aggregation);
        JavaVirtualMachine machine = null;
        try {
            machine = gcToolKit.analyze(new SingleGCLogFile(new TestLogFile("cms/defnew/details/defnew.log").getFile().toPath()));
        } catch (IOException e) {
            fail(e.getMessage());
        }
        Assertions.assertTrue(machine.getAggregation(clazz).isEmpty());
    }

    @Tag("modulePath")
    @Test
    void testNoAggregationRegistered() {
        workFlow(new MissingAnnotationAggregation(), MissingAnnotationTest.MissingAnnotationAggregation.class);
    }

    @Tag("modulePath")
    @Test
    void testSuppliedAggregation() {
        workFlow(new MissingEventSource(), MissingAnnotationTest.MissingEventSource.class);
    }

    /************* Aggregator/Aggregation with missing Collates annotation */

Review comment (suggestion):
```suggestion
    private void workFlow(Aggregation aggregation, Class clazz) {
```

Code after:
package com.microsoft.gctoolkit.integration;

import com.microsoft.gctoolkit.GCToolKit;
import com.microsoft.gctoolkit.aggregator.Aggregates;
import com.microsoft.gctoolkit.aggregator.Aggregation;
import com.microsoft.gctoolkit.aggregator.Aggregator;
import com.microsoft.gctoolkit.aggregator.Collates;
import com.microsoft.gctoolkit.aggregator.EventSource;
import com.microsoft.gctoolkit.integration.io.TestLogFile;
import com.microsoft.gctoolkit.io.SingleGCLogFile;
import com.microsoft.gctoolkit.jvm.JavaVirtualMachine;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.fail;

@Tag("modulePath")
public class MissingAnnotationTest {

    @SuppressWarnings("unchecked")
    private void workFlow(Aggregation aggregation, Class clazz) {
        GCToolKit gcToolKit = new GCToolKit();
        // Load our test aggregation instead of calling GCToolKit::loadAggregationsFromServiceLoader
        gcToolKit.loadAggregation(aggregation);
        JavaVirtualMachine machine = null;
        try {
            machine = gcToolKit.analyze(new SingleGCLogFile(new TestLogFile("cms/defnew/details/defnew.log").getFile().toPath()));
        } catch (IOException e) {
            fail(e.getMessage());
        }
        Assertions.assertTrue(machine.getAggregation(clazz).isEmpty());
    }

    @Tag("modulePath")
    @Test
    void testNoAggregationRegistered() {
        workFlow(new MissingAnnotationAggregation(), MissingAnnotationTest.MissingAnnotationAggregation.class);
    }

    @Tag("modulePath")
    @Test
    void testSuppliedAggregation() {
        workFlow(new MissingEventSource(), MissingAnnotationTest.MissingEventSource.class);
    }

    /************* Aggregator/Aggregation with missing Collates annotation */