gt:             if (StringUtils.equals(candidateModel.getReportName(), name))
context: package org.jboss.windup.tests.application;
  
  import com.google.common.base.Predicate;
  import com.google.common.collect.Iterables;
  import org.apache.commons.io.FileUtils;
  import org.apache.commons.lang3.RandomStringUtils;
  import org.apache.commons.lang3.StringUtils;
  import org.jboss.windup.exec.WindupProcessor;
  import org.jboss.windup.exec.WindupProgressMonitor;
  import org.jboss.windup.exec.configuration.WindupConfiguration;
  import org.jboss.windup.exec.configuration.options.ExportCSVOption;
  import org.jboss.windup.graph.GraphContext;
  import org.jboss.windup.graph.GraphContextFactory;
  import org.jboss.windup.graph.model.ProjectModel;
  import org.jboss.windup.graph.service.GraphService;
  import org.jboss.windup.graph.service.Service;
  import org.jboss.windup.reporting.model.ApplicationReportModel;
  import org.jboss.windup.reporting.model.MigrationIssuesReportModel;
  import org.jboss.windup.reporting.model.ReportModel;
  import org.jboss.windup.reporting.service.ReportService;
  import org.jboss.windup.rules.apps.java.config.ExcludePackagesOption;
  import org.jboss.windup.rules.apps.java.config.ScanPackagesOption;
  import org.jboss.windup.rules.apps.java.config.SourceModeOption;
  import org.jboss.windup.rules.apps.java.dependencyreport.CreateDependencyReportRuleProvider;
  import org.jboss.windup.rules.apps.java.model.JavaApplicationOverviewReportModel;
  import org.jboss.windup.rules.apps.java.model.JavaClassFileModel;
  import org.jboss.windup.rules.apps.java.reporting.rules.CreateDependencyGraphReportRuleProvider;
  import org.jboss.windup.rules.apps.java.reporting.rules.CreateJavaApplicationOverviewReportRuleProvider;
  import org.jboss.windup.rules.apps.java.reporting.rules.EnableCompatibleFilesReportOption;
  import org.jboss.windup.rules.apps.tattletale.DisableTattletaleReportOption;
  import org.junit.Assert;
  
  import javax.annotation.Nullable;
  import javax.inject.Inject;
  import java.io.File;
  import java.nio.file.Path;
  import java.nio.file.Paths;
  import java.util.*;
  
  /**
   * Base class for Windup end-to-end tests.
   *
   * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
   */
  public abstract class WindupArchitectureTest
  {
      public static final String REPORTS_TEMPLATES_MIGRATION_ISSUES_FTL = "/reports/templates/migration-issues.ftl";
  
      @Inject
      private WindupProcessor processor;
  
      @Inject
      private GraphContextFactory factory;
  
      /**
       * Get an instance of the {@link GraphContextFactory}.
       */
      protected GraphContextFactory getFactory()
      {
          return factory;
      }
  
      Path getDefaultPath()
      {
          return FileUtils.getTempDirectory().toPath().resolve("Windup")
                      .resolve("windupgraph_" + RandomStringUtils.randomAlphanumeric(6));
      }
  
      protected GraphContext createGraphContext()
      {
          return createGraphContext(getDefaultPath());
      }
  
      GraphContext createGraphContext(Path path)
      {
          return factory.create(path, true);
      }
  
      protected void runTest(String inputPath, boolean sourceMode) throws Exception
      {
          runTest(Collections.singletonList(inputPath), sourceMode);
      }
  
      protected void runTest(Iterable<String> inputPaths, boolean sourceMode) throws Exception
      {
          List<String> includeList = Collections.emptyList();
          List<String> excludeList = Collections.emptyList();
          runTest(createGraphContext(), inputPaths, null, sourceMode, includeList, excludeList);
      }
  
      protected void runTest(GraphContext graphContext, String inputPath, String userRulesDir, boolean sourceMode) throws Exception
      {
          List<String> incl = Collections.emptyList();
          List<String> excl = Collections.emptyList();
          runTest(graphContext, Collections.singletonList(inputPath), Collections.singletonList(new File(userRulesDir)), sourceMode, incl, excl);
      }
  
      protected void runTest(GraphContext graphContext, String inputPath, boolean sourceMode)
                  throws Exception
      {
          runTest(graphContext, Collections.singletonList(inputPath), sourceMode);
      }
  
      void runTest(GraphContext graphContext, Iterable<String> inputPaths, boolean sourceMode)
                  throws Exception
      {
          List<String> includeList = Collections.emptyList();
          List<String> excludeList = Collections.emptyList();
          runTest(graphContext, inputPaths, null, sourceMode, includeList, excludeList);
      }
  
      void runTest(GraphContext graphContext, String inputPath, boolean sourceMode,
                  List<String> includePackages) throws Exception
      {
          runTest(graphContext, Collections.singletonList(inputPath), sourceMode, includePackages);
      }
  
      void runTest(GraphContext graphContext, Iterable<String> inputPaths, boolean sourceMode,
                  List<String> includePackages) throws Exception
      {
          List<String> excludeList = Collections.emptyList();
          runTest(graphContext, inputPaths, null, sourceMode, includePackages, excludeList);
      }
  
      void runTest(final GraphContext graphContext,
                  final String inputPath,
                  final Iterable<File> userRulesDirs,
                  final boolean sourceMode,
                  final List<String> includePackages,
                  final List<String> excludePackages) throws Exception
      {
          runTest(graphContext, Collections.singletonList(inputPath), userRulesDirs, sourceMode, includePackages, excludePackages);
      }
  
      void runTest(final GraphContext graphContext,
                  final Iterable<String> inputPaths,
                  final Iterable<File> userRulesDirs,
                  final boolean sourceMode,
                  final List<String> includePackages,
                  final List<String> excludePackages) throws Exception
      {
          Map<String, Object> otherOptions = Collections.emptyMap();
          runTest(graphContext, inputPaths, userRulesDirs, sourceMode, includePackages, excludePackages, otherOptions);
      }
  
      void runTest(final GraphContext graphContext,
                  final Iterable<String> inputPaths,
                  final Iterable<File> userRulesDirs,
                  final boolean sourceMode,
                  final List<String> includePackages,
                  final List<String> excludePackages,
                  final Map<String, Object> otherOptions) throws Exception
      {
  
      	Locale previousLocale = Locale.getDefault();
      	Locale.setDefault(Locale.US);
          WindupConfiguration windupConfiguration = new WindupConfiguration().setGraphContext(graphContext);
          windupConfiguration.setAlwaysHaltOnException(true);
          for (String inputPath : inputPaths)
          {
              windupConfiguration.addInputPath(Paths.get(inputPath));
          }
          windupConfiguration.setOutputDirectory(graphContext.getGraphDirectory());
          if (userRulesDirs != null)        {
              for (File uRulesDir : userRulesDirs)            {
                  windupConfiguration.addDefaultUserRulesDirectory(uRulesDir.toPath());
                  windupConfiguration.addDefaultUserLabelsDirectory(uRulesDir.toPath());
              }
          }
          windupConfiguration.setOptionValue(SourceModeOption.NAME, sourceMode);
          windupConfiguration.setOptionValue(ScanPackagesOption.NAME, includePackages);
          windupConfiguration.setOptionValue(ExcludePackagesOption.NAME, excludePackages);
          windupConfiguration.setOptionValue(DisableTattletaleReportOption.NAME, true);
          windupConfiguration.setOptionValue(EnableCompatibleFilesReportOption.NAME, true);
          windupConfiguration.setOptionValue(ExportCSVOption.NAME, true);
  
          for (Map.Entry<String, Object> otherOption : otherOptions.entrySet())
          {
              windupConfiguration.setOptionValue(otherOption.getKey(), otherOption.getValue());
          }
  
          RecordingWindupProgressMonitor recordingMonitor = new RecordingWindupProgressMonitor();
          WindupProgressMonitor testMonitor = overrideWindupProgressMonitor(recordingMonitor);
          windupConfiguration.setProgressMonitor(testMonitor);
  
          processor.execute(windupConfiguration);
  
          assertRecordedData(recordingMonitor);
  
          Locale.setDefault(previousLocale);
      }
  
      /**
       * Override to customize what's expected.
       */
      protected void assertRecordedData(RecordingWindupProgressMonitor recordingMonitor)
      {
          Assert.assertFalse(recordingMonitor.isCancelled());
          Assert.assertTrue(recordingMonitor.isDone());
          Assert.assertFalse(recordingMonitor.getSubTaskNames().isEmpty());
          Assert.assertTrue(recordingMonitor.getTotalWork() > 0);
          Assert.assertTrue(recordingMonitor.getCompletedWork() > 0);
          Assert.assertEquals(recordingMonitor.getTotalWork() + 1, recordingMonitor.getCompletedWork());
      }
  
      /**
       * Override this if you need to intercept the calls to WindupProgressMonitor.
       * The overriding method must keep the functionality of passed monitor.
       * See {@link CombinedWindupProgressMonitor}.
       */
      public WindupProgressMonitor overrideWindupProgressMonitor(final WindupProgressMonitor testMonitor)
      {
          return testMonitor;
      }
  
      JavaApplicationOverviewReportModel getMainApplicationReport(GraphContext context)
      {
          return (JavaApplicationOverviewReportModel) getReport(context, CreateJavaApplicationOverviewReportRuleProvider.TEMPLATE_APPLICATION_REPORT,
                      CreateJavaApplicationOverviewReportRuleProvider.DETAILS_REPORT);
      }
  
      Iterable<ReportModel> getApplicationDetailsReports(GraphContext context)
      {
          return getReports(context, CreateJavaApplicationOverviewReportRuleProvider.TEMPLATE_APPLICATION_REPORT);
      }
  
      MigrationIssuesReportModel getMigrationIssuesReport(GraphContext context, final ProjectModel projectModel)
      {
          Iterable<ReportModel> reportModels = Iterables.filter(getReports(context, REPORTS_TEMPLATES_MIGRATION_ISSUES_FTL),
                      new Predicate<ReportModel>()
                      {
                          @Override
                          public boolean apply(@Nullable ReportModel input)
                          {
                              if (!(input instanceof MigrationIssuesReportModel))
                                  return false;
  
                              MigrationIssuesReportModel migrationIssuesReportModel = (MigrationIssuesReportModel) input;
                              return projectModel == null || projectModel.equals(migrationIssuesReportModel.getProjectModel());
                          }
                      });
  
          if (!reportModels.iterator().hasNext())
              return null;
  
          if (Iterables.size(reportModels) > 1)
              Assert.fail("Only one migration issues report expected for the application!");
  
          return (MigrationIssuesReportModel)reportModels.iterator().next();
      }
  
      MigrationIssuesReportModel getMigrationIssuesReport(GraphContext context)
      {
          return (MigrationIssuesReportModel) getReport(context, REPORTS_TEMPLATES_MIGRATION_ISSUES_FTL, "Issues");
      }
  
      ApplicationReportModel getJarDependencyReport(GraphContext context)
      {
          return (ApplicationReportModel) getReport(context, CreateDependencyReportRuleProvider.TEMPLATE, CreateDependencyReportRuleProvider.REPORT_NAME);
      }
  
      Iterable<ReportModel> getReports(GraphContext context, String template)
      {
          ReportService reportService = new ReportService(context);
          return reportService.findAllByProperty(ReportModel.TEMPLATE_PATH, template);
      }
  
      ReportModel getReport(GraphContext context, String template, String name)
      {
          ReportService reportService = new ReportService(context);
          Iterable<ReportModel> reportModels = reportService.findAllByProperty(
                      ReportModel.TEMPLATE_PATH,
                      template);
          ReportModel reportModel = null;
          for (ReportModel candidateModel : reportModels)
          {
  