3434 * Main class for executing the JSR 354 TCK. 
3535 * Created by Anatole on 12.06.2014. 
3636 */ 
37- public  class  TCKRunner  extends  XmlSuite {
38-     public  TCKRunner (){
37+ public  class  TCKRunner  extends  XmlSuite   {
38+     public  TCKRunner ()  {
3939        setName ("JSR354-TCK 1.0" );
4040        XmlTest  test  = new  XmlTest (this );
4141        test .setName ("TCK/Test Setup" );
@@ -55,7 +55,7 @@ public TCKRunner(){
5555        test .setXmlClasses (classes );
5656    }
5757
58-     public  static  void  main (String ... args ){
58+     public  static  void  main (String ... args )  {
5959        System .out .println ("-- JSR 354 TCK started --" );
6060        List <XmlSuite > suites  = new  ArrayList <>();
6161        suites .add (new  TCKRunner ());
@@ -72,7 +72,7 @@ public static void main(String... args){
7272        System .out .println ("-- JSR 354 TCK finished --" );
7373    }
7474
75-     public  static  final  class  TCKReporter  extends  TestListenerAdapter {
75+     public  static  final  class  TCKReporter  extends  TestListenerAdapter   {
7676        private  int  count  = 0 ;
7777        private  int  skipped  = 0 ;
7878        private  int  failed  = 0 ;
@@ -81,101 +81,92 @@ public static final class TCKReporter extends TestListenerAdapter{
8181        private  StringWriter  internalBuffer  = new  StringWriter (3000 );
8282        private  FileWriter  w ;
8383
84-         public  TCKReporter (File  file ){
85-             try {
86-                 if (!file .exists ()){
84+         public  TCKReporter (File  file )  {
85+             try   {
86+                 if   (!file .exists ())  {
8787                    file .createNewFile ();
8888                }
8989                w  = new  FileWriter (file );
9090                w .write ("*****************************************************************************************\n " );
9191                w .write ("**** JSR 354 - Money & Currency, Technical Compatibility Kit, version 1.0\n " );
9292                w .write ("*****************************************************************************************\n \n " );
93-                 w .write ("Executed on "  + new  java .util .Date () +"\n \n "   );
93+                 w .write ("Executed on "  + new  java .util .Date () +  "\n \n " );
9494
9595                // System.out: 
9696                internalBuffer .write ("*****************************************************************************************\n " );
9797                internalBuffer .write ("**** JSR 354 - Money & Currency, Technical Compatibility Kit, version 1.0\n " );
9898                internalBuffer .write ("*****************************************************************************************\n \n " );
9999                internalBuffer .write ("Executed on "  + new  java .util .Date () + "\n \n " );
100-             }
101-             catch (IOException  e ){
100+             } catch  (IOException  e ) {
102101                e .printStackTrace ();
103102                System .exit (-1 );
104103            }
105104        }
106105
107106        @ Override 
108-         public  void  onTestFailure (ITestResult  tr ){
107+         public  void  onTestFailure (ITestResult  tr )  {
109108            failed ++;
110-             String  location  = tr .getTestClass ().getRealClass ().getSimpleName ()+ '#' + tr .getMethod ().getMethodName ();
111-             try {
109+             String  location  = tr .getTestClass ().getRealClass ().getSimpleName () +  '#'  +  tr .getMethod ().getMethodName ();
110+             try   {
112111                Method  realTestMethod  = tr .getMethod ().getMethod ();
113112                Test  testAnnot  = realTestMethod .getAnnotation (Test .class );
114-                 if (testAnnot != null  && testAnnot .description ()!= null  && !testAnnot .description ().isEmpty ()){
115-                     if (tr .getThrowable ()!= null ){
113+                 if   (testAnnot  !=  null  && testAnnot .description () !=  null  && !testAnnot .description ().isEmpty ())  {
114+                     if   (tr .getThrowable () !=  null )  {
116115                        StringWriter  sw  = new  StringWriter ();
117116                        PrintWriter  w  = new  PrintWriter (sw );
118117                        tr .getThrowable ().printStackTrace (w );
119118                        w .flush ();
120-                         log ("[FAILED]  "  + testAnnot .description () + "(" +location +"):\n " +sw .toString ());
121-                     }
122-                     else {
123-                         log ("[FAILED]  "  + testAnnot .description ()+ "(" +location +")" );
119+                         log ("[FAILED]  "  + testAnnot .description () + "("  + location  + "):\n "  + sw .toString ());
120+                     } else  {
121+                         log ("[FAILED]  "  + testAnnot .description () + "("  + location  + ")" );
124122                    }
125-                 }
126-                 else {
123+                 } else  {
127124
128-                     if (tr .getThrowable ()!= null ){
125+                     if   (tr .getThrowable () !=  null )  {
129126                        StringWriter  sw  = new  StringWriter ();
130127                        PrintWriter  w  = new  PrintWriter (sw );
131128                        tr .getThrowable ().printStackTrace (w );
132129                        w .flush ();
133-                         log ("[FAILED]  "  + location  + ":\n " +sw .toString ());
134-                     }
135-                     else {
130+                         log ("[FAILED]  "  + location  + ":\n "  + sw .toString ());
131+                     } else  {
136132                        log ("[FAILED]  "  + location );
137133                    }
138134                }
139-             }
140-             catch (IOException  e ){
135+             } catch  (IOException  e ) {
141136                throw  new  IllegalStateException ("IO Error" , e );
142137            }
143138        }
144139
145140        @ Override 
146-         public  void  onTestSkipped (ITestResult  tr ){
141+         public  void  onTestSkipped (ITestResult  tr )  {
147142            skipped ++;
148-             String  location  = tr .getTestClass ().getRealClass ().getSimpleName ()+ '#' + tr .getMethod ().getMethodName ();
149-             try {
143+             String  location  = tr .getTestClass ().getRealClass ().getSimpleName () +  '#'  +  tr .getMethod ().getMethodName ();
144+             try   {
150145                Method  realTestMethod  = tr .getMethod ().getMethod ();
151146                Test  specAssert  = realTestMethod .getAnnotation (Test .class );
152-                 if (specAssert !=null  && specAssert .description ()!=null  && !specAssert .description ().isEmpty ()){
153-                     log ("[SKIPPED] "  + specAssert .description ()+ "(" +location +")" );
154-                 }
155-                 else {
147+                 if  (specAssert  != null  && specAssert .description () != null  && !specAssert .description ().isEmpty ()) {
148+                     log ("[SKIPPED] "  + specAssert .description () + "("  + location  + ")" );
149+                 } else  {
156150                    log ("[SKIPPED] "  + location );
157151                }
158-             }
159-             catch (IOException  e ){
152+             } catch  (IOException  e ) {
160153                throw  new  IllegalStateException ("IO Error" , e );
161154            }
162155        }
163156
164157        @ Override 
165-         public  void  onTestSuccess (ITestResult  tr ){
158+         public  void  onTestSuccess (ITestResult  tr )  {
166159            success ++;
167-             String  location  = tr .getTestClass ().getRealClass ().getSimpleName ()+ '#' + tr .getMethod ().getMethodName ();
168-             try {
160+             String  location  = tr .getTestClass ().getRealClass ().getSimpleName () +  '#'  +  tr .getMethod ().getMethodName ();
161+             try   {
169162                Method  realTestMethod  = tr .getMethod ().getMethod ();
170163                Test  specAssert  = realTestMethod .getAnnotation (Test .class );
171-                 if (specAssert !=null  && specAssert .description ()!=null  && !specAssert .description ().isEmpty ()){
172-                     log ("[SUCCESS] "  + specAssert .description ()+ "(" +location +")" );
173-                 }
174-                 else {
164+                 if  (specAssert  != null  && specAssert .description () != null  && !specAssert .description ().isEmpty ()) {
165+                     log ("[SUCCESS] "  + specAssert .description () + "("  + location  + ")" );
166+                 } else  {
175167                    log ("[SUCCESS] "  + location );
176168                }
177-             }
178-             catch (IOException  e ){
169+             } catch  (IOException  e ) {
179170                throw  new  IllegalStateException ("IO Error" , e );
180171            }
181172        }
@@ -188,8 +179,8 @@ private void log(String text) throws IOException {
188179            internalBuffer .write ('\n' );
189180        }
190181
191-         public  void  writeSummary (){
192-             try {
182+         public  void  writeSummary ()  {
183+             try   {
193184                log ("\n JSR 354 TCP version 1.0 Summary" );
194185                log ("-------------------------------" );
195186                log ("\n TOTAL TESTS EXECUTED : "  + count );
@@ -201,8 +192,7 @@ public void writeSummary(){
201192                internalBuffer .flush ();
202193                System .out .println ();
203194                System .out .println (internalBuffer );
204-             }
205-             catch (IOException  e ){
195+             } catch  (IOException  e ) {
206196                throw  new  IllegalStateException ("IO Error" , e );
207197            }
208198        }
0 commit comments