@@ -105,7 +105,7 @@ def test_build_normal
105105
106106 # PMD binary does not exist yet this time...
107107 record_expectations ( sha1_head : 'sha1abc' , sha1_base : 'sha1abc' , zip_file_exists : false )
108- stub_pmd_build_maven ( binary_name : "pmd-bin-#{ @pmd_version } .zip" )
108+ stub_pmd_build_maven ( binary_name : "pmd-bin-#{ @pmd_version } .zip" ) # file is pmd-bin-...
109109 PmdTester ::Cmd . stubs ( :execute_successfully ) . with (
110110 "unzip -qo pmd-dist/target/pmd-bin-#{ @pmd_version } .zip " \
111111 '-d pmd-dist/target/exploded'
@@ -129,7 +129,32 @@ def test_build_normal_pmd7
129129
130130 # PMD binary does not exist yet this time...
131131 record_expectations ( sha1_head : 'sha1abc' , sha1_base : 'sha1abc' , zip_file_exists : false )
132- stub_pmd_build_maven ( binary_name : "pmd-dist-#{ @pmd_version } -bin.zip" )
132+ stub_pmd_build_maven ( binary_name : "pmd-dist-#{ @pmd_version } -bin.zip" ) # file is pmd-dist-...
133+ PmdTester ::Cmd . stubs ( :execute_successfully ) . with (
134+ "unzip -qo pmd-dist/target/pmd-dist-#{ @pmd_version } -bin.zip " \
135+ '-d pmd-dist/target/exploded'
136+ ) . once
137+ PmdTester ::Cmd . stubs ( :execute_successfully ) . with (
138+ "mv pmd-dist/target/exploded/pmd-bin-#{ @pmd_version } " \
139+ "#{ Dir . getwd } /target/pmd-bin-#{ @pmd_version } -main-sha1abc"
140+ ) . once
141+ record_expectations_after_build
142+
143+ PmdTester ::PmdReportBuilder
144+ . new ( projects , options , options . base_config , options . base_branch )
145+ . build
146+ end
147+
148+ def test_build_normal_pmd7_new_build
149+ @pmd_version = '7.14.0'
150+ projects = [ ]
151+ argv = %w[ -r target/repositories/pmd -b main -p pmd_releases/7.14.0
152+ -c config/design.xml -l test/resources/pmd_report_builder/project-test.xml ]
153+ options = PmdTester ::Options . new ( argv )
154+
155+ # PMD binary does not exist yet this time...
156+ record_expectations ( sha1_head : 'sha1abc' , sha1_base : 'sha1abc' , zip_file_exists : false )
157+ stub_pmd_build_maven_new_pmd7_build ( )
133158 PmdTester ::Cmd . stubs ( :execute_successfully ) . with (
134159 "unzip -qo pmd-dist/target/pmd-dist-#{ @pmd_version } -bin.zip " \
135160 '-d pmd-dist/target/exploded'
@@ -357,4 +382,19 @@ def stub_pmd_build_maven(binary_name:)
357382 end
358383 end . once
359384 end
385+
386+ def stub_pmd_build_maven_new_pmd7_build ( )
387+ PmdTester ::Cmd . stubs ( :execute_successfully ) . with do |cmd |
388+ if cmd == './mvnw clean package ' \
389+ '-PfastSkip ' \
390+ '-DskipTests ' \
391+ '-T1C -B'
392+ FileUtils . mkdir_p 'pmd-dist/target'
393+ FileUtils . touch "pmd-dist/target/pmd-dist-#{ @pmd_version } -bin.zip"
394+ true
395+ else
396+ false
397+ end
398+ end . once
399+ end
360400end
0 commit comments