88import org .dom4j .Document ;
99import org .dom4j .Element ;
1010import org .dom4j .io .SAXReader ;
11+ import org .fugerit .java .junit5 .tag .check .model .ExecutedTest ;
12+ import org .fugerit .java .junit5 .tag .check .model .TestStats ;
1113import org .junit .jupiter .api .Tag ;
1214
1315import java .io .File ;
@@ -290,10 +292,10 @@ private void generateTextReport(Map<ExecutedTest, Set<String>> testTagMap)
290292 tagToTests .computeIfAbsent (tag , k -> new ArrayList <>()).add (test );
291293
292294 TestStats stats = tagStats .computeIfAbsent (tag , k -> new TestStats ());
293- stats .total ++ ;
294- if (test .isFailed ()) stats .failed ++ ;
295- if (test .isError ()) stats .errors ++ ;
296- if (test .isSkipped ()) stats .skipped ++ ;
295+ stats .increaseTotal () ;
296+ if (test .isFailed ()) stats .increaseFailed () ;
297+ if (test .isError ()) stats .increaseErrors () ;
298+ if (test .isSkipped ()) stats .increaseSkipped () ;
297299 }
298300 }
299301
@@ -305,9 +307,9 @@ private void generateTextReport(Map<ExecutedTest, Set<String>> testTagMap)
305307
306308 for (Map .Entry <String , TestStats > entry : tagStats .entrySet ()) {
307309 TestStats stats = entry .getValue ();
308- int passed = stats .total - stats .failed - stats .errors - stats .skipped ;
310+ int passed = stats .getTotal () - stats .getFailed () - stats .getErrors () - stats .getSkipped () ;
309311 writer .write (String .format ("%-20s | %5d | %5d | %5d | %5d%n" ,
310- entry .getKey (), stats .total , passed , stats .failed , stats .errors ));
312+ entry .getKey (), stats .getTotal () , passed , stats .getFailed () , stats .getErrors () ));
311313 }
312314
313315 // Tests without tags
@@ -562,37 +564,4 @@ private String escapeXml(String str) {
562564 .replace ("'" , "'" );
563565 }
564566
565- // Helper classes
566- static class ExecutedTest {
567- private final String className ;
568- private final String methodName ;
569- private final boolean skipped ;
570- private final boolean failed ;
571- private final boolean error ;
572- private final String time ;
573-
574- public ExecutedTest (String className , String methodName ,
575- boolean skipped , boolean failed , boolean error , String time ) {
576- this .className = className ;
577- this .methodName = methodName ;
578- this .skipped = skipped ;
579- this .failed = failed ;
580- this .error = error ;
581- this .time = time ;
582- }
583-
584- public String getClassName () { return className ; }
585- public String getMethodName () { return methodName ; }
586- public boolean isSkipped () { return skipped ; }
587- public boolean isFailed () { return failed ; }
588- public boolean isError () { return error ; }
589- public String getTime () { return time ; }
590- }
591-
592- static class TestStats {
593- int total = 0 ;
594- int failed = 0 ;
595- int errors = 0 ;
596- int skipped = 0 ;
597- }
598567}
0 commit comments