@@ -14,7 +14,7 @@ def test_build_skip
1414 record_expecations_after_build
1515
1616 PmdTester ::PmdReportBuilder
17- . new ( options . base_config , projects , options . local_git_repo , options . base_branch )
17+ . new ( projects , options , options . base_config , options . base_branch )
1818 . build
1919 end
2020
@@ -33,7 +33,7 @@ def test_build_normal
3333 record_expecations_after_build
3434
3535 PmdTester ::PmdReportBuilder
36- . new ( options . base_config , projects , options . local_git_repo , options . base_branch )
36+ . new ( projects , options , options . base_config , options . base_branch )
3737 . build
3838 end
3939
@@ -52,24 +52,45 @@ def test_build_with_projects
5252 record_expectations_project_build
5353
5454 PmdTester ::PmdReportBuilder
55- . new ( options . base_config , projects , options . local_git_repo , options . base_branch )
55+ . new ( projects , options , options . base_config , options . base_branch )
5656 . build
5757
5858 expected = File . read ( 'test/resources/pmd_report_builder/expected-config.xml' )
5959 actual = File . read ( 'target/reports/master/checkstyle/config.xml' )
6060 assert_equal ( expected , actual )
6161 end
6262
63+ def test_build_error_recovery
64+ project_list = 'test/resources/pmd_report_builder/project-list.xml'
65+ projects = PmdTester ::ProjectsParser . new . parse ( project_list )
66+ assert_equal ( 1 , projects . size )
67+ argv = %w[ -r target/repositories/pmd -b master -p pmd_releases/6.1.0
68+ -c config/design.xml --debug --error-recovery -l ]
69+ argv . push project_list
70+ options = PmdTester ::Options . new ( argv )
71+
72+ projects [ 0 ] . auxclasspath = '-auxclasspath extra:dirs'
73+ record_expectations ( 'sha1abc' , 'sha1abc' , true )
74+ record_expecations_after_build
75+ record_expectations_project_build ( true )
76+
77+ PmdTester ::PmdReportBuilder
78+ . new ( projects , options , options . base_config , options . base_branch )
79+ . build
80+ end
81+
6382 private
6483
65- def record_expectations_project_build
84+ def record_expectations_project_build ( error = false )
6685 PmdTester ::ProjectBuilder . any_instance . stubs ( :clone_projects ) . once
6786 PmdTester ::ProjectBuilder . any_instance . stubs ( :build_projects ) . once
6887 PmdTester ::SimpleProgressLogger . any_instance . stubs ( :start ) . once
6988 PmdTester ::SimpleProgressLogger . any_instance . stubs ( :stop ) . once
7089 File . stubs ( :exist? ) . with ( 'target/reports/master/checkstyle/pmd_report.xml' ) . returns ( false ) . once
90+ error_prefix = error ? 'PMD_JAVA_OPTS="-Dpmd.error_recovery -ea" ' : ''
7191 PmdTester ::Cmd . stubs ( :execute )
72- . with ( 'target/pmd-bin-6.10.0-SNAPSHOT/bin/run.sh ' \
92+ . with ( "#{ error_prefix } " \
93+ 'target/pmd-bin-6.10.0-SNAPSHOT/bin/run.sh ' \
7394 'pmd -d target/repositories/checkstyle -f xml ' \
7495 '-R target/reports/master/checkstyle/config.xml ' \
7596 '-r target/reports/master/checkstyle/pmd_report.xml ' \
0 commit comments