MCPcopy Create free account
hub / github.com/RealTimeGenomics/rtg-tools / main

Method main

src/test/java/RtgTestEntry.java:151–197  ·  view source on GitHub ↗

Test runner entry point @param args list of test classes to run @throws ClassNotFoundException can't load the specified classes

(final String[] args)

Source from the content-addressed store, hash-verified

149 * @throws ClassNotFoundException can't load the specified classes
150 */
151 public static void main(final String[] args) throws ClassNotFoundException {
152 final JUnitCore jUnitCore = new JUnitCore();
153 if (CAPTURE_OUTPUT) {
154 jUnitCore.addListener(new OutputListener());
155 }
156 jUnitCore.addListener(new TextListener(new RealSystem()));
157 final TimingListener timing;
158 if (COLLECT_TIMINGS) {
159 timing = new TimingListener();
160 jUnitCore.addListener(timing);
161 } else {
162 timing = null;
163 }
164 if (PRINT_FAILURES) {
165 jUnitCore.addListener(new FailureListener());
166 }
167 if (PRINT_NAMES) {
168 jUnitCore.addListener(new NameListener());
169 }
170 jUnitCore.addListener(new NewLineListener());
171 final List<Result> results = new ArrayList<>();
172 if (args.length > 0) {
173 for (final String arg : args) {
174 final Class<?> klass = ClassLoader.getSystemClassLoader().loadClass(arg);
175 results.add(jUnitCore.run(klass));
176 }
177 } else {
178 final Class<?>[] classes = getClasses();
179 results.add(jUnitCore.run(classes));
180 }
181 if (timing != null) {
182 final Map<String, Long> timings = timing.getTimings(LONG_TEST_THRESHOLD);
183 if (timings.size() > 1) {
184 System.out.println();
185 System.out.println("Long tests");
186 for (Map.Entry<String, Long> entry : timings.entrySet()) {
187 System.out.println(formatTimeRow(entry.getKey(), entry.getValue(), TIMING_WIDTH));
188 }
189 }
190 }
191
192 for (Result result : results) {
193 if (!result.wasSuccessful()) {
194 System.exit(1);
195 }
196 }
197 }
198
199 /**
200 * Simple formatting of a test timing row.

Callers

nothing calls this directly

Calls 10

getClassesMethod · 0.95
getTimingsMethod · 0.95
formatTimeRowMethod · 0.95
addListenerMethod · 0.80
printlnMethod · 0.80
entrySetMethod · 0.80
addMethod · 0.65
runMethod · 0.65
getValueMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected