@Test void testCompareMultipleUseCasesRemoved() { List<UseCase> baseUseCases = getUseCases(USE_CASE_NAME_2); List<UseCase> comparisonUseCases = getUseCases(USE_CASE_NAME_1, USE_CASE_NAME_2, USE_CASE_NAME_3); UseCase removedUseCase1 = comparisonUseCases.get(0); UseCase removedUseCase2 = comparisonUseCases.get(2); UseCaseDiffInfo useCaseDiffInfo = getUseCaseDiffInfo(0, 0, 0, 0); initMocks(baseUseCases, comparisonUseCases, useCaseDiffInfo); BuildDiffInfo buildDiffInfo = useCaseComparator.compare(); double expectedChangeRate = 200.0 / 3.0; assertEquals(expectedChangeRate, buildDiffInfo.getChangeRate(), 0.0); assertEquals(0, buildDiffInfo.getAdded()); assertEquals(0, buildDiffInfo.getChanged()); assertEquals(2, buildDiffInfo.getRemoved()); assertTrue(buildDiffInfo.getAddedElements().isEmpty()); assertEquals(removedUseCase1, buildDiffInfo.getRemovedElements().get(0)); assertEquals(removedUseCase2, buildDiffInfo.getRemovedElements().get(1)); }
public BuildDiffInfo compare() { final List<UseCase> baseUseCases = scenarioDocuReader.loadUsecases(parameters.getBaseBranchName(), parameters.getBaseBuildName()); final List<UseCase> comparisonUseCases = scenarioDocuReader.loadUsecases( parameters.getComparisonConfiguration().getComparisonBranchName(), parameters.getComparisonConfiguration().getComparisonBuildName()); final BuildDiffInfo buildDiffInfo = new BuildDiffInfo(parameters.getComparisonConfiguration().getName(), parameters.getComparisonConfiguration().getComparisonBranchName(), parameters.getComparisonConfiguration().getComparisonBuildName()); calculateDiffInfo(baseUseCases, comparisonUseCases, buildDiffInfo); buildDiffInfo.setStatus(ComparisonCalculationStatus.SUCCESS); LOGGER.info(getLogMessage(buildDiffInfo, "Build " + parameters.getBaseBranchName() + "/" + parameters.getBaseBuildName())); return buildDiffInfo; }
UseCaseComparator extends AbstractStructureComparator<UseCase, String, UseCase> { public BuildDiffInfo compare() { final List<UseCase> baseUseCases = scenarioDocuReader.loadUsecases(parameters.getBaseBranchName(), parameters.getBaseBuildName()); final List<UseCase> comparisonUseCases = scenarioDocuReader.loadUsecases( parameters.getComparisonConfiguration().getComparisonBranchName(), parameters.getComparisonConfiguration().getComparisonBuildName()); final BuildDiffInfo buildDiffInfo = new BuildDiffInfo(parameters.getComparisonConfiguration().getName(), parameters.getComparisonConfiguration().getComparisonBranchName(), parameters.getComparisonConfiguration().getComparisonBuildName()); calculateDiffInfo(baseUseCases, comparisonUseCases, buildDiffInfo); buildDiffInfo.setStatus(ComparisonCalculationStatus.SUCCESS); LOGGER.info(getLogMessage(buildDiffInfo, "Build " + parameters.getBaseBranchName() + "/" + parameters.getBaseBuildName())); return buildDiffInfo; } }
UseCaseComparator extends AbstractStructureComparator<UseCase, String, UseCase> { public BuildDiffInfo compare() { final List<UseCase> baseUseCases = scenarioDocuReader.loadUsecases(parameters.getBaseBranchName(), parameters.getBaseBuildName()); final List<UseCase> comparisonUseCases = scenarioDocuReader.loadUsecases( parameters.getComparisonConfiguration().getComparisonBranchName(), parameters.getComparisonConfiguration().getComparisonBuildName()); final BuildDiffInfo buildDiffInfo = new BuildDiffInfo(parameters.getComparisonConfiguration().getName(), parameters.getComparisonConfiguration().getComparisonBranchName(), parameters.getComparisonConfiguration().getComparisonBuildName()); calculateDiffInfo(baseUseCases, comparisonUseCases, buildDiffInfo); buildDiffInfo.setStatus(ComparisonCalculationStatus.SUCCESS); LOGGER.info(getLogMessage(buildDiffInfo, "Build " + parameters.getBaseBranchName() + "/" + parameters.getBaseBuildName())); return buildDiffInfo; } UseCaseComparator(ComparisonParameters parameters); }
UseCaseComparator extends AbstractStructureComparator<UseCase, String, UseCase> { public BuildDiffInfo compare() { final List<UseCase> baseUseCases = scenarioDocuReader.loadUsecases(parameters.getBaseBranchName(), parameters.getBaseBuildName()); final List<UseCase> comparisonUseCases = scenarioDocuReader.loadUsecases( parameters.getComparisonConfiguration().getComparisonBranchName(), parameters.getComparisonConfiguration().getComparisonBuildName()); final BuildDiffInfo buildDiffInfo = new BuildDiffInfo(parameters.getComparisonConfiguration().getName(), parameters.getComparisonConfiguration().getComparisonBranchName(), parameters.getComparisonConfiguration().getComparisonBuildName()); calculateDiffInfo(baseUseCases, comparisonUseCases, buildDiffInfo); buildDiffInfo.setStatus(ComparisonCalculationStatus.SUCCESS); LOGGER.info(getLogMessage(buildDiffInfo, "Build " + parameters.getBaseBranchName() + "/" + parameters.getBaseBuildName())); return buildDiffInfo; } UseCaseComparator(ComparisonParameters parameters); BuildDiffInfo compare(); }
UseCaseComparator extends AbstractStructureComparator<UseCase, String, UseCase> { public BuildDiffInfo compare() { final List<UseCase> baseUseCases = scenarioDocuReader.loadUsecases(parameters.getBaseBranchName(), parameters.getBaseBuildName()); final List<UseCase> comparisonUseCases = scenarioDocuReader.loadUsecases( parameters.getComparisonConfiguration().getComparisonBranchName(), parameters.getComparisonConfiguration().getComparisonBuildName()); final BuildDiffInfo buildDiffInfo = new BuildDiffInfo(parameters.getComparisonConfiguration().getName(), parameters.getComparisonConfiguration().getComparisonBranchName(), parameters.getComparisonConfiguration().getComparisonBuildName()); calculateDiffInfo(baseUseCases, comparisonUseCases, buildDiffInfo); buildDiffInfo.setStatus(ComparisonCalculationStatus.SUCCESS); LOGGER.info(getLogMessage(buildDiffInfo, "Build " + parameters.getBaseBranchName() + "/" + parameters.getBaseBuildName())); return buildDiffInfo; } UseCaseComparator(ComparisonParameters parameters); BuildDiffInfo compare();  }