@@ -455,19 +455,19 @@ public void testisgroovyScriptFalse() {
455
455
}
456
456
457
457
/**
458
- * test the main method on a java file
458
+ * test the runFormatter method on a java file
459
459
*/
460
- public void testmainOnAJavaFile () {
461
- log .info ("Formatter.main on a java file" );
460
+ public void testrunFormatterOnAJavaFile () {
461
+ log .info ("Formatter.runFormatter on a java file" );
462
462
fileName = System .getProperty ("user.dir" ) + File .separator + "javaEclipseFormatterTest13243546.java" ;
463
463
absolutePathFile = new File (fileName );
464
464
String before = " package groovyTest;\n public class genericJavaClass"
465
- + "{\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n }\n }" ;
465
+ + "{\n public static main(String[] args) {\n // TODO Auto-generated method stub\n }\n }" ;
466
466
try {
467
467
absolutePathFile .createNewFile ();
468
468
String [] args = new String [] { "-java" , fileName };
469
469
FileUtils .writeStringToFile (absolutePathFile , before );
470
- Formatter .main (args );
470
+ Formatter .runFormatter (args );
471
471
} catch (SecurityException e ) {
472
472
log .error (e , e );
473
473
} catch (IOException e ) {
@@ -478,10 +478,10 @@ public void testmainOnAJavaFile() {
478
478
}
479
479
480
480
/**
481
- * test the main method on a groovy file
481
+ * test the runFormatter method on a groovy file
482
482
*/
483
- public void testmainOnAGroovyFile () {
484
- log .info ("Formatter.main on a groovy file" );
483
+ public void testrunFormatterOnAGroovyFile () {
484
+ log .info ("Formatter.runFormatter on a groovy file" );
485
485
fileName = System .getProperty ("user.dir" ) + File .separator + "javaEclipseFormatterTest13243546.groovy" ;
486
486
absolutePathFile = new File (fileName );
487
487
String before = " package groovyTest;\n public class genericJavaClass"
@@ -490,20 +490,21 @@ public void testmainOnAGroovyFile() {
490
490
absolutePathFile .createNewFile ();
491
491
String [] args = new String [] { "-groovy" , fileName };
492
492
FileUtils .writeStringToFile (absolutePathFile , before );
493
- Formatter .main (args );
493
+ Formatter .runFormatter (args );
494
494
} catch (SecurityException e ) {
495
495
log .error (e , e );
496
496
} catch (IOException e ) {
497
497
log .error (e , e );
498
498
}
499
- assertTrue ("Formatter.main on a groovy file that does exist" , !before .equals (Formatter .readInFile (fileName )));
499
+ assertTrue ("Formatter.runFormatter on a groovy file that does exist" ,
500
+ !before .equals (Formatter .readInFile (fileName )));
500
501
}
501
502
502
503
/**
503
- * Test the main method on a directory
504
+ * Test the runFormatter method on a directory
504
505
*/
505
- public void testmainOnADirectory () {
506
- log .info ("Formatter.main on a directory that does exist" );
506
+ public void testrunFormatterOnADirectory () {
507
+ log .info ("Formatter.runFormatter on a directory that does exist" );
507
508
String dirName = System .getProperty ("user.dir" ) + File .separator + "test" ;
508
509
String fileName1 = System .getProperty ("user.dir" ) + File .separator + "test" + File .separator
509
510
+ "javaEclipseFormatterTest13243546.java" ;
@@ -525,14 +526,14 @@ public void testmainOnADirectory() {
525
526
FileUtils .writeStringToFile (absolutePathFile1 , before1 );
526
527
FileUtils .writeStringToFile (absolutePathFile2 , before2 );
527
528
String [] args = new String [] { dirName };
528
- Formatter .main (args );
529
+ Formatter .runFormatter (args );
529
530
} catch (SecurityException e ) {
530
531
log .error (e , e );
531
532
} catch (IOException e ) {
532
533
log .error (e , e );
533
534
}
534
- assertTrue ("Formatter.main on a directory that does exist" , ! before1 . equals ( Formatter . readInFile ( fileName1 ))
535
- && !before2 .equals (Formatter .readInFile (fileName2 )));
535
+ assertTrue ("Formatter.runFormatter on a directory that does exist" ,
536
+ ! before1 . equals ( Formatter . readInFile ( fileName1 )) && !before2 .equals (Formatter .readInFile (fileName2 )));
536
537
if (absolutePathFile1 != null ) {
537
538
if (absolutePathFile1 .exists ()) {
538
539
absolutePathFile1 .delete ();
@@ -551,10 +552,10 @@ public void testmainOnADirectory() {
551
552
}
552
553
553
554
/**
554
- * Test the main method on a directory with a groovy script
555
+ * Test the runFormatter method on a directory with a groovy script
555
556
*/
556
- public void testmainOnADirectoryGroovyScript () {
557
- log .info ("Formatter.main on a directory that does exist with a groovy script" );
557
+ public void testrunFormatterOnADirectoryGroovyScript () {
558
+ log .info ("Formatter.runFormatter on a directory that does exist with a groovy script" );
558
559
String dirName = System .getProperty ("user.dir" ) + File .separator + "test" ;
559
560
String fileName1 = System .getProperty ("user.dir" ) + File .separator + "test" + File .separator
560
561
+ "javaEclipseFormatterTest13243546.java" ;
@@ -576,14 +577,14 @@ public void testmainOnADirectoryGroovyScript() {
576
577
FileUtils .writeStringToFile (absolutePathFile1 , before1 );
577
578
FileUtils .writeStringToFile (absolutePathFile2 , before2 );
578
579
String [] args = new String [] { dirName };
579
- Formatter .main (args );
580
+ Formatter .runFormatter (args );
580
581
} catch (SecurityException e ) {
581
582
log .error (e , e );
582
583
} catch (IOException e ) {
583
584
log .error (e , e );
584
585
}
585
- assertTrue ("Formatter.main on a directory that does exist" , ! before1 . equals ( Formatter . readInFile ( fileName1 ))
586
- && !before2 .equals (Formatter .readInFile (fileName2 )));
586
+ assertTrue ("Formatter.runFormatter on a directory that does exist" ,
587
+ ! before1 . equals ( Formatter . readInFile ( fileName1 )) && !before2 .equals (Formatter .readInFile (fileName2 )));
587
588
if (absolutePathFile1 != null ) {
588
589
if (absolutePathFile1 .exists ()) {
589
590
absolutePathFile1 .delete ();
@@ -602,10 +603,10 @@ public void testmainOnADirectoryGroovyScript() {
602
603
}
603
604
604
605
/**
605
- * Test the main method on a directory with a groovy script and javaflag set
606
+ * Test the runFormatter method on a directory with a groovy script and javaflag set
606
607
*/
607
- public void testmainOnADirectoryGroovyScriptJavaFlagSet () {
608
- log .info ("Formatter.main on a directory that does exist with a groovy script and javaflag set" );
608
+ public void testrunFormatterOnADirectoryGroovyScriptJavaFlagSet () {
609
+ log .info ("Formatter.runFormatter on a directory that does exist with a groovy script and javaflag set" );
609
610
String dirName = System .getProperty ("user.dir" ) + File .separator + "test" ;
610
611
String fileName1 = System .getProperty ("user.dir" ) + File .separator + "test" + File .separator
611
612
+ "javaEclipseFormatterTest13243546.java" ;
@@ -627,13 +628,13 @@ public void testmainOnADirectoryGroovyScriptJavaFlagSet() {
627
628
FileUtils .writeStringToFile (absolutePathFile1 , before1 );
628
629
FileUtils .writeStringToFile (absolutePathFile2 , before2 );
629
630
String [] args = new String [] { "-java" , dirName };
630
- Formatter .main (args );
631
+ Formatter .runFormatter (args );
631
632
} catch (SecurityException e ) {
632
633
log .error (e , e );
633
634
} catch (IOException e ) {
634
635
log .error (e , e );
635
636
}
636
- assertTrue ("Formatter.main on a directory that does exist with a groovy script and javaflag set" ,
637
+ assertTrue ("Formatter.runFormatter on a directory that does exist with a groovy script and javaflag set" ,
637
638
!before1 .equals (Formatter .readInFile (fileName1 )) && before2 .equals (Formatter .readInFile (fileName2 )));
638
639
if (absolutePathFile1 != null ) {
639
640
if (absolutePathFile1 .exists ()) {
@@ -653,10 +654,10 @@ public void testmainOnADirectoryGroovyScriptJavaFlagSet() {
653
654
}
654
655
655
656
/**
656
- * Test the main method on a directory with a groovy script and Groovy flag set
657
+ * Test the runFormatter method on a directory with a groovy script and Groovy flag set
657
658
*/
658
- public void testmainOnADirectoryGroovyScriptGroovyFlagSet () {
659
- log .info ("Formatter.main on a directory that does exist with a groovy script and Groovy flag set" );
659
+ public void testrunFormatterOnADirectoryGroovyScriptGroovyFlagSet () {
660
+ log .info ("Formatter.runFormatter on a directory that does exist with a groovy script and Groovy flag set" );
660
661
String dirName = System .getProperty ("user.dir" ) + File .separator + "test" ;
661
662
String fileName1 = System .getProperty ("user.dir" ) + File .separator + "test" + File .separator
662
663
+ "javaEclipseFormatterTest13243546.java" ;
@@ -678,13 +679,13 @@ public void testmainOnADirectoryGroovyScriptGroovyFlagSet() {
678
679
FileUtils .writeStringToFile (absolutePathFile1 , before1 );
679
680
FileUtils .writeStringToFile (absolutePathFile2 , before2 );
680
681
String [] args = new String [] { "-groovy" , dirName };
681
- Formatter .main (args );
682
+ Formatter .runFormatter (args );
682
683
} catch (SecurityException e ) {
683
684
log .error (e , e );
684
685
} catch (IOException e ) {
685
686
log .error (e , e );
686
687
}
687
- assertTrue ("Formatter.main on a directory that does exist with a groovy script and Groovy flag set" ,
688
+ assertTrue ("Formatter.runFormatter on a directory that does exist with a groovy script and Groovy flag set" ,
688
689
before1 .equals (Formatter .readInFile (fileName1 )) && !before2 .equals (Formatter .readInFile (fileName2 )));
689
690
if (absolutePathFile1 != null ) {
690
691
if (absolutePathFile1 .exists ()) {
@@ -704,25 +705,26 @@ public void testmainOnADirectoryGroovyScriptGroovyFlagSet() {
704
705
}
705
706
706
707
/**
707
- * test the main method on a groovy file
708
+ * test the runFormatter method on a groovy file that has unrecognizable syntax
708
709
*/
709
- public void testmainOnAGroovyFileparseError () {
710
- log .info ("Formatter.main on a groovy file" );
710
+ public void testrunFormatterOnAGroovyFileparseError () {
711
+ log .info ("Formatter.runFormatter on a groovy file that has unrecognizable syntax " );
711
712
fileName = System .getProperty ("user.dir" ) + File .separator + "javaEclipseFormatterTest13243546.groovy" ;
712
713
absolutePathFile = new File (fileName );
713
- String before = "\n @artifact.package@class @artifact.name@ { \n "
714
- + "public class genericJavaClass" + " {\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n }\n }" ;
714
+ String before = "\n @artifact.package@class @artifact.name@ { \n " + "public class genericJavaClass"
715
+ + "{\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n }\n }" ;
715
716
try {
716
717
absolutePathFile .createNewFile ();
717
718
String [] args = new String [] { "-groovy" , fileName };
718
719
FileUtils .writeStringToFile (absolutePathFile , before );
719
- Formatter .main (args );
720
+ Formatter .runFormatter (args );
720
721
} catch (SecurityException e ) {
721
722
log .error (e , e );
722
723
} catch (IOException e ) {
723
724
log .error (e , e );
724
725
}
725
- assertTrue ("Formatter.main on a groovy file that does exist" , before .equals (Formatter .readInFile (fileName )));
726
+ assertTrue ("Formatter.runFormatter on a groovy file that has unrecognizable syntax" ,
727
+ before .equals (Formatter .readInFile (fileName )));
726
728
}
727
729
}
728
730
0 commit comments