| 1 19 20 package org.netbeans.modules.junit.output; 21 22 import java.awt.EventQueue ; 23 import java.io.File ; 24 import java.util.ArrayList ; 25 import java.util.Collection ; 26 import java.util.Collections ; 27 import org.netbeans.api.java.classpath.ClassPath; 28 import org.openide.ErrorManager; 29 import org.openide.filesystems.FileObject; 30 31 38 final class Report { 39 40 File antScript; 41 File resultsDir; 42 String suiteClassName; 43 String classpath; 44 ClassPath platformSources; 45 Collection <FileObject> classpathSourceRoots; 46 String [] outputStd; 47 String [] outputErr; 48 int totalTests; 49 int failures; 50 int errors; 51 int elapsedTimeMillis; 52 55 int detectedPassedTests; 56 private Collection <Testcase> tests; 57 private boolean closed = false; 58 59 61 Report(String suiteClassName) { 62 this.suiteClassName = suiteClassName; 63 this.antScript = antScript; 64 this.tests = new ArrayList <Testcase>(10); 65 } 66 67 69 void reportTest(Testcase test) { 70 71 72 73 tests.add(test); 75 76 if (test.trouble == null) { 77 detectedPassedTests++; 78 } 79 } 80 81 83 void update(Report report) { 84 85 86 87 89 this.resultsDir = report.resultsDir; 91 this.suiteClassName = report.suiteClassName; 92 this.outputStd = report.outputStd; 93 this.outputErr = report.outputErr; 94 this.totalTests = report.totalTests; 95 this.failures = report.failures; 96 this.errors = report.errors; 97 this.elapsedTimeMillis = report.elapsedTimeMillis; 98 this.detectedPassedTests = report.detectedPassedTests; 99 this.tests = report.tests; 100 } 101 102 104 Collection <Testcase> getTests() { 105 106 113 114 if (tests.isEmpty()) { 116 final Collection <Testcase> emptyList = Collections.emptyList(); 117 return emptyList; 118 } else { 119 return new ArrayList <Testcase>(tests); 120 } 121 } 122 123 125 boolean containsFailed() { 126 assert EventQueue.isDispatchThread(); 127 128 129 130 return (failures + errors) != 0; 131 } 132 133 135 static final class Testcase { 136 String className; 137 String name; 138 int timeMillis; 139 Trouble trouble; 140 } 141 142 144 static final class Trouble { 145 146 private final boolean error; 147 String message; 148 String exceptionClsName; 149 String [] stackTrace; 150 Trouble nestedTrouble; 151 152 154 Trouble(boolean error) { 155 this.error = error; 156 } 157 158 159 boolean isError() { 160 return error; 161 } 162 163 } 164 165 } 166 | Popular Tags |