@@ -204,7 +204,7 @@ def test_build_pmd7
204204    record_expectations ( sha1_head : sha1 ,  sha1_base : sha1 ,  zip_file_exists : true ) 
205205    record_expectations_after_build 
206206    record_expectations_project_build ( sha1 : sha1 ,  error : true ,  long_cli_options : true , 
207-                                       no_progress_bar : true ,  base_cmd :  'pmd check' ) 
207+                                       no_progress_bar : true ,  pmd7 :  true ) 
208208
209209    pmd_cli_cmd  =  prepare_pmd_dist_dir ( version : @pmd_version ,  sha1 : sha1 ) 
210210    begin 
@@ -241,8 +241,23 @@ def test_build_failing
241241
242242  private 
243243
244+   def  determine_cli_cmd_and_options ( pmd7 :,  long_cli_options :) 
245+     if  pmd7 
246+       base_cmd  =  'pmd check' 
247+       fail_on_violation  =  '--no-fail-on-violation' 
248+       auxclasspath_option  =  '--aux-classpath extra:dirs' 
249+     else 
250+       base_cmd  =  'run.sh pmd' 
251+       fail_on_violation  =  long_cli_options  ? '--fail-on-violation false'  : '-failOnViolation false' 
252+       auxclasspath_option  =  long_cli_options  ? '--aux-classpath extra:dirs'  : '-auxclasspath extra:dirs' 
253+     end 
254+     [ base_cmd ,  fail_on_violation ,  auxclasspath_option ] 
255+   end 
256+ 
244257  def  record_expectations_project_build ( sha1 :,  error : false ,  long_cli_options : false , 
245-                                         no_progress_bar : false ,  exit_status : 0 ,  base_cmd : 'run.sh pmd' ) 
258+                                         no_progress_bar : false ,  exit_status : 0 ,  pmd7 : false ) 
259+     base_cmd ,  fail_on_violation ,  auxclasspath_option  =  determine_cli_cmd_and_options ( pmd7 : pmd7 , 
260+                                                                                      long_cli_options : long_cli_options ) 
246261    PmdTester ::ProjectBuilder . any_instance . stubs ( :clone_projects ) . once 
247262    PmdTester ::ProjectBuilder . any_instance . stubs ( :build_projects ) . once 
248263    PmdTester ::SimpleProgressLogger . any_instance . stubs ( :start ) . once 
@@ -257,8 +272,7 @@ def record_expectations_project_build(sha1:, error: false, long_cli_options: fal
257272                        '-d target/repositories/checkstyle -f xml '  \
258273                        '-R target/reports/master/checkstyle/config.xml '  \
259274                        '-r target/reports/master/checkstyle/pmd_report.xml '  \
260-                         "#{ long_cli_options  ? '--fail-on-violation false'  : '-failOnViolation false' }   -t 1 "  \
261-                         "#{ long_cli_options  ? '--aux-classpath extra:dirs'  : '-auxclasspath extra:dirs' }  "  \
275+                         "#{ fail_on_violation }   -t 1 #{ auxclasspath_option }  "  \
262276                        "#{ no_progress_bar  ? ' --no-progress'  : '' }  " , 
263277                        'target/reports/master/checkstyle' ) . once 
264278                  . returns ( process_status ) 
0 commit comments