001/* 002 * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. 008 * 009 * This code is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 012 * version 2 for more details (a copy is included in the LICENSE file that 013 * accompanied this code). 014 * 015 * You should have received a copy of the GNU General Public License version 016 * 2 along with this work; if not, write to the Free Software Foundation, 017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 018 * 019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 020 * or visit www.oracle.com if you need additional information or have any 021 * questions. 022 */ 023package com.oracle.mxtool.junit; 024 025import java.io.*; 026 027import org.junit.internal.*; 028import org.junit.runner.*; 029import org.junit.runner.notification.*; 030 031public class VerboseTextListener extends TextRunListener { 032 033 public VerboseTextListener(JUnitSystem system) { 034 this(system.out()); 035 } 036 037 public VerboseTextListener(PrintStream writer) { 038 super(writer); 039 } 040 041 @Override 042 public void testClassStarted(Class<?> clazz) { 043 getWriter().print(clazz.getName() + " started"); 044 } 045 046 @Override 047 public void testClassFinished(Class<?> clazz) { 048 getWriter().print(clazz.getName() + " finished"); 049 } 050 051 @Override 052 public void testStarted(Description description) { 053 getWriter().print(" " + description.getMethodName() + ": "); 054 } 055 056 @Override 057 public void testIgnored(Description description) { 058 getWriter().print("Ignored"); 059 } 060 061 @Override 062 public void testSucceeded(Description description) { 063 getWriter().print("Passed"); 064 } 065 066 @Override 067 public void testAssumptionFailure(Failure failure) { 068 getWriter().printf("(%s) ", failure.getMessage()); 069 } 070 071 @Override 072 public void testFailed(Failure failure) { 073 getWriter().print("FAILED"); 074 lastFailure = failure; 075 } 076 077 @Override 078 public void testClassFinishedDelimiter() { 079 getWriter().println(); 080 } 081 082 @Override 083 public void testClassStartedDelimiter() { 084 getWriter().println(); 085 } 086 087 @Override 088 public void testFinishedDelimiter() { 089 getWriter().println(); 090 } 091 092}