// Path: src/main/java/bv/offa/netbeans/cnd/unittest/api/CndTestSuite.java
// public class CndTestSuite extends TestSuite
// {
//     private final TestFramework framework;
//     
//     public CndTestSuite(String name, TestFramework framework)
//     {
//         super(name);
//         this.framework = framework;
//     }
// 
//     
//     /**
//      * Returns the framework.
//      * 
//      * @return  Framework
//      */
//     public TestFramework getFramework()
//     {
//         return framework;
//     }
//     
// }
// 
// Path: src/main/java/bv/offa/netbeans/cnd/unittest/api/ManagerAdapter.java
// public interface ManagerAdapter
// {
//     
//     /**
//      * Displays the result report for the test session.
//      * 
//      * @param session       Test session
//      * @param report        Report
//      */
//     public void displayReport(TestSession session, Report report);
//     
//     
//     /**
//      * Finishes the test session.
//      * 
//      * @param session   Test session
//      */
//     public void sessionFinished(TestSession session);
//     
//     
//     /**
//      * Starts the test session.
//      * 
//      * @param session       Test session
//      */
//     public void testStarted(TestSession session);
//     
//     
//     /**
//      * Displays the test suite as running within the session.
//      * 
//      * @param session       Test session
//      * @param suite         Test suite
//      */
//     public void displaySuiteRunning(TestSession session, TestSuite suite);
//     
// }
// 
// Path: src/main/java/bv/offa/netbeans/cnd/unittest/api/TestFramework.java
// public enum TestFramework
// {
//     /** CppUTest. */
//     CPPUTEST("CppUTest"),
//     /** GoogleTest / GoogleMock. */
//     GOOGLETEST("GoogleTest"),
//     /** LibunittestC++. */
//     LIBUNITTESTCPP("LibunittestCpp");
// 
// 
//     private final String name;
// 
// 
//     TestFramework(String name)
//     {
//         this.name = name;
//     }
// 
// 
//     /**
//      * Returns the name of the framework.
//      *
//      * @return  Name
//      */
//     public String getName()
//     {
//         return name;
//     }
// }
// 
// Path: src/test/java/bv/offa/netbeans/cnd/unittest/testhelper/Helper.java
// public static Matcher checkedMatch(CndTestHandler handler, String input)
// {
//     final Matcher m = handler.match(input);
//     assertThat(m.find()).isTrue();
//     return m;
// }
// 
// Path: src/test/java/bv/offa/netbeans/cnd/unittest/testhelper/Helper.java
// public static CndTestSuite createCurrentTestSuite(String suiteName, TestFramework framework,
//                                                     TestSession session)
// {
//     final CndTestSuite testSuite = new CndTestSuite(suiteName, framework);
//     when(session.getCurrentSuite()).thenReturn(testSuite);
// 
//     return testSuite;
// }
// 
// Path: src/test/java/bv/offa/netbeans/cnd/unittest/testhelper/MockArgumentMatcher.java
// public static ArgumentMatcher<TestSuite> isSuite(String suite)
// {
//     return new ArgumentMatcherImpl<TestSuite>("isSuite()", suite)
//     {
//         @Override
//         public boolean matches(TestSuite t)
//         {
//             return t.getName().equals(suite);
//         }
//     };
// }


import bv.offa.netbeans.cnd.unittest.api.CndTestSuite;
import bv.offa.netbeans.cnd.unittest.api.ManagerAdapter;
import bv.offa.netbeans.cnd.unittest.api.TestFramework;
import static bv.offa.netbeans.cnd.unittest.testhelper.Helper.checkedMatch;
import static bv.offa.netbeans.cnd.unittest.testhelper.Helper.createCurrentTestSuite;
import static bv.offa.netbeans.cnd.unittest.testhelper.MockArgumentMatcher.isSuite;
import static com.google.common.truth.Truth.assertThat;
import java.util.regex.Matcher;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.ArgumentMatchers.eq;
import org.mockito.InOrder;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.netbeans.api.project.Project;
import org.netbeans.modules.gsf.testrunner.api.Report;
import org.netbeans.modules.gsf.testrunner.api.TestSession;
import org.netbeans.modules.gsf.testrunner.api.TestSuite;
import org.openide.filesystems.FileUtil;
import org.openide.util.Lookup;
        checkedMatch(handler, "[----------] 1 test from TestSuite");
        handler.updateUI(manager, session);
        verify(manager).testStarted(session);
    }

    @Test
    public void updateUIStartsTestBeforeSuite()
    {
        checkedMatch(handler, "[----------] 1 test from TestSuite");
        handler.updateUI(manager, session);
        InOrder inOrder = inOrder(manager);
        inOrder.verify(manager).testStarted(any(TestSession.class));
        inOrder.verify(manager).displaySuiteRunning(any(TestSession.class), any(CndTestSuite.class));
    }

    @Test
    public void updateUIDisplaysReportIfNotFirstTest()
    {
        checkedMatch(handler, "[----------] 1 test from TestSuite");
        when(session.getReport(anyLong())).thenReturn(report);
        handler.updateUI(manager, session);
        handler.updateUI(manager, session);
        verify(manager).displayReport(session, report);
    }

    @Test
    public void updateUIStartsNewSuiteIfFirstSuite()
    {
        checkedMatch(handler, "[----------] 1 test from TestSuite");
        handler.updateUI(manager, session);
// Path: src/main/java/bv/offa/netbeans/cnd/unittest/api/CndTestSuite.java
// public class CndTestSuite extends TestSuite
// {
//     private final TestFramework framework;
//     
//     public CndTestSuite(String name, TestFramework framework)
//     {
//         super(name);
//         this.framework = framework;
//     }
// 
//     
//     /**
//      * Returns the framework.
//      * 
//      * @return  Framework
//      */
//     public TestFramework getFramework()
//     {
//         return framework;
//     }
//     
// }
// 
// Path: src/main/java/bv/offa/netbeans/cnd/unittest/api/ManagerAdapter.java
// public interface ManagerAdapter
// {
//     
//     /**
//      * Displays the result report for the test session.
//      * 
//      * @param session       Test session
//      * @param report        Report
//      */
//     public void displayReport(TestSession session, Report report);
//     
//     
//     /**
//      * Finishes the test session.
//      * 
//      * @param session   Test session
//      */
//     public void sessionFinished(TestSession session);
//     
//     
//     /**
//      * Starts the test session.
//      * 
//      * @param session       Test session
//      */
//     public void testStarted(TestSession session);
//     
//     
//     /**
//      * Displays the test suite as running within the session.
//      * 
//      * @param session       Test session
//      * @param suite         Test suite
//      */
//     public void displaySuiteRunning(TestSession session, TestSuite suite);
//     
// }
// 
// Path: src/main/java/bv/offa/netbeans/cnd/unittest/api/TestFramework.java
// public enum TestFramework
// {
//     /** CppUTest. */
//     CPPUTEST("CppUTest"),
//     /** GoogleTest / GoogleMock. */
//     GOOGLETEST("GoogleTest"),
//     /** LibunittestC++. */
//     LIBUNITTESTCPP("LibunittestCpp");
// 
// 
//     private final String name;
// 
// 
//     TestFramework(String name)
//     {
//         this.name = name;
//     }
// 
// 
//     /**
//      * Returns the name of the framework.
//      *
//      * @return  Name
//      */
//     public String getName()
//     {
//         return name;
//     }
// }
// 
// Path: src/test/java/bv/offa/netbeans/cnd/unittest/testhelper/Helper.java
// public static Matcher checkedMatch(CndTestHandler handler, String input)
// {
//     final Matcher m = handler.match(input);
//     assertThat(m.find()).isTrue();
//     return m;
// }
// 
// Path: src/test/java/bv/offa/netbeans/cnd/unittest/testhelper/Helper.java
// public static CndTestSuite createCurrentTestSuite(String suiteName, TestFramework framework,
//                                                     TestSession session)
// {
//     final CndTestSuite testSuite = new CndTestSuite(suiteName, framework);
//     when(session.getCurrentSuite()).thenReturn(testSuite);
// 
//     return testSuite;
// }
// 
// Path: src/test/java/bv/offa/netbeans/cnd/unittest/testhelper/MockArgumentMatcher.java
// public static ArgumentMatcher<TestSuite> isSuite(String suite)
// {
//     return new ArgumentMatcherImpl<TestSuite>("isSuite()", suite)
//     {
//         @Override
//         public boolean matches(TestSuite t)
//         {
//             return t.getName().equals(suite);
//         }
//     };
// }


// Path: src/test/java/bv/offa/netbeans/cnd/unittest/googletest/GoogleTestSuiteStartedHandlerTest.java
import bv.offa.netbeans.cnd.unittest.api.CndTestSuite;
import bv.offa.netbeans.cnd.unittest.api.ManagerAdapter;
import bv.offa.netbeans.cnd.unittest.api.TestFramework;
import static bv.offa.netbeans.cnd.unittest.testhelper.Helper.checkedMatch;
import static bv.offa.netbeans.cnd.unittest.testhelper.Helper.createCurrentTestSuite;
import static bv.offa.netbeans.cnd.unittest.testhelper.MockArgumentMatcher.isSuite;
import static com.google.common.truth.Truth.assertThat;
import java.util.regex.Matcher;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.ArgumentMatchers.eq;
import org.mockito.InOrder;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.netbeans.api.project.Project;
import org.netbeans.modules.gsf.testrunner.api.Report;
import org.netbeans.modules.gsf.testrunner.api.TestSession;
import org.netbeans.modules.gsf.testrunner.api.TestSuite;
import org.openide.filesystems.FileUtil;
import org.openide.util.Lookup;

        checkedMatch(handler, "[----------] 1 test from TestSuite");
        handler.updateUI(manager, session);
        verify(manager).testStarted(session);
    }

    @Test
    public void updateUIStartsTestBeforeSuite()
    {
        checkedMatch(handler, "[----------] 1 test from TestSuite");
        handler.updateUI(manager, session);
        InOrder inOrder = inOrder(manager);
        inOrder.verify(manager).testStarted(any(TestSession.class));
        inOrder.verify(manager).displaySuiteRunning(any(TestSession.class), any(CndTestSuite.class));
    }

    @Test
    public void updateUIDisplaysReportIfNotFirstTest()
    {
        checkedMatch(handler, "[----------] 1 test from TestSuite");
        when(session.getReport(anyLong())).thenReturn(report);
        handler.updateUI(manager, session);
        handler.updateUI(manager, session);
        verify(manager).displayReport(session, report);
    }

    @Test
    public void updateUIStartsNewSuiteIfFirstSuite()
    {
        checkedMatch(handler, "[----------] 1 test from TestSuite");
        handler.updateUI(manager, session);
        verify(session).addSuite(argThat(isSuite("TestSuite")));