Commit | Line | Data |
---|---|---|
78d66988 | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2013, 2014 Ericsson |
78d66988 AM |
3 | * |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Alexandre Montplaisir - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.core.tests.shared; |
78d66988 AM |
14 | |
15 | import org.junit.runner.Description; | |
16 | import org.junit.runner.notification.Failure; | |
17 | import org.junit.runner.notification.RunListener; | |
18 | ||
19 | /** | |
20 | * Debugging RunListener, which will print to stdout the name of the tests being | |
21 | * run. | |
22 | * | |
23 | * @author Alexandre Montplaisir | |
24 | */ | |
25 | public class DebugListener extends RunListener { | |
26 | ||
27 | @Override | |
28 | public void testStarted(Description description) { | |
29 | System.out.println("Running " + getTestName(description)); | |
30 | } | |
31 | ||
32 | @Override | |
33 | public void testAssumptionFailure(Failure failure) { | |
34 | System.out.println("SKIPPING TEST: " + getTestName(failure.getDescription())); | |
35 | System.out.println(failure.getMessage()); | |
36 | } | |
37 | ||
38 | /** | |
39 | * Get the className#methodName from a Description. | |
40 | */ | |
41 | private static String getTestName(Description description) { | |
42 | return description.getClassName() + '#' + description.getMethodName(); | |
43 | } | |
44 | } |