You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2011/12/30 16:08:51 UTC
svn commit: r1225838 -
/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/
Author: hboutemy
Date: Fri Dec 30 15:08:51 2011
New Revision: 1225838
URL: http://svn.apache.org/viewvc?rev=1225838&view=rev
Log:
code formatting
Modified:
maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java
maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConfigurableParallelComputerTest.java
maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/DiagnosticRunListener.java
maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java
maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListenerTest.java
maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire813IncorrectResultTest.java
maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java
Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java?rev=1225838&r1=1225837&r2=1225838&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentReporterManagerTest.java Fri Dec 30 15:08:51 2011
@@ -1,3 +1,5 @@
+package org.apache.maven.surefire.junitcore;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -17,9 +19,6 @@
* under the License.
*/
-package org.apache.maven.surefire.junitcore;
-
-
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.HashMap;
@@ -42,7 +41,6 @@ import org.junit.runner.JUnitCore;
/*
* @author Kristian Rosenvold
*/
-
public class ConcurrentReporterManagerTest
extends TestCase
{
@@ -107,7 +105,6 @@ public class ConcurrentReporterManagerTe
runClasses( 2, 0, 0, Junit3OddTest1.class );
}
-
public void testSimpleOutput()
throws Exception
{
@@ -213,7 +210,6 @@ public class ConcurrentReporterManagerTe
@Test
public void testNotMuch()
{
-
}
@Ignore
@@ -230,11 +226,9 @@ public class ConcurrentReporterManagerTe
public static class DummyWithFailure
{
-
@Test
public void testBeforeFail()
{
-
}
@Test
@@ -255,7 +249,6 @@ public class ConcurrentReporterManagerTe
@Test
public void testNotMuchA()
{
-
}
@Test
@@ -328,7 +321,6 @@ public class ConcurrentReporterManagerTe
System.out.println( "testStubJ3TC2A" );
}
-
public static junit.framework.Test suite()
{
TestSuite suite = new TestSuite();
@@ -341,8 +333,6 @@ public class ConcurrentReporterManagerTe
public static class Junit3OddTest1
extends TestCase
{
-
-
public static junit.framework.Test suite()
{
TestSuite suite = new TestSuite();
@@ -353,7 +343,6 @@ public class ConcurrentReporterManagerTe
return suite;
}
-
public Junit3OddTest1( String name )
{
super( name );
@@ -368,8 +357,6 @@ public class ConcurrentReporterManagerTe
public static class Junit3WithNestedSuite
extends TestCase
{
-
-
public static junit.framework.Test suite()
{
TestSuite suite = new TestSuite();
@@ -380,7 +367,6 @@ public class ConcurrentReporterManagerTe
return suite;
}
-
public Junit3WithNestedSuite( String name )
{
super( name );
Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConfigurableParallelComputerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConfigurableParallelComputerTest.java?rev=1225838&r1=1225837&r2=1225838&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConfigurableParallelComputerTest.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConfigurableParallelComputerTest.java Fri Dec 30 15:08:51 2011
@@ -1,3 +1,5 @@
+package org.apache.maven.surefire.junitcore;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -17,8 +19,6 @@
* under the License.
*/
-package org.apache.maven.surefire.junitcore;
-
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
@@ -240,6 +240,7 @@ public class ConfigurableParallelCompute
}
}
+
public static class Dummy
{
@Test
@@ -299,8 +300,6 @@ public class ConfigurableParallelCompute
{
sleepReallyEvenOnWindows( 2 * scaling );
}
-
-
}
public static class FailingAssertions
@@ -334,13 +333,10 @@ public class ConfigurableParallelCompute
{
}
-
@Test
public void testWithException()
{
throw new RuntimeException( "We expect this" );
}
-
-
}
}
\ No newline at end of file
Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/DiagnosticRunListener.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/DiagnosticRunListener.java?rev=1225838&r1=1225837&r2=1225838&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/DiagnosticRunListener.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/DiagnosticRunListener.java Fri Dec 30 15:08:51 2011
@@ -1,3 +1,5 @@
+package org.apache.maven.surefire.junitcore;
+
/*
* Copyright 2002-2009 the original author or authors.
*
@@ -16,100 +18,144 @@
* Also licensed under CPL http://junit.sourceforge.net/cpl-v10.html
*/
-
-package org.apache.maven.surefire.junitcore;
-
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.runner.Description;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;
+
/*
* @author Kristian Rosenvold, kristianAzeniorD0Tno
*/
-
-public class DiagnosticRunListener extends RunListener {
- private final AtomicInteger numTestStarted = new AtomicInteger();
- private final AtomicInteger numTestFailed = new AtomicInteger();
- private final AtomicInteger numTestAssumptionsFailed = new AtomicInteger();
- private final AtomicInteger numTestFinished = new AtomicInteger();
- private final AtomicInteger numTestIgnored = new AtomicInteger();
+public class DiagnosticRunListener
+ extends RunListener
+{
+ private final AtomicInteger numTestStarted = new AtomicInteger();
+ private final AtomicInteger numTestFailed = new AtomicInteger();
+ private final AtomicInteger numTestAssumptionsFailed = new AtomicInteger();
+ private final AtomicInteger numTestFinished = new AtomicInteger();
+ private final AtomicInteger numTestIgnored = new AtomicInteger();
private final boolean printToConsole;
private final RunListener target;
- private void print(String event, Description description) {
- if (printToConsole) System.out.println(Thread.currentThread().toString() + ", event = " + event + ", " + description);
- }
- private void print(String event, Result description) {
- if (printToConsole) System.out.println(Thread.currentThread().toString() + ", event = " + event + ", " + description);
- }
- private void print(String event, Failure description) {
- if (printToConsole) System.out.println(Thread.currentThread().toString() + ", event = " + event + ", " + description);
+ private void print( String event, Description description )
+ {
+ if ( printToConsole )
+ {
+ System.out.println( Thread.currentThread().toString() + ", event = " + event + ", " + description );
+ }
+ }
+
+ private void print( String event, Result description )
+ {
+ if ( printToConsole )
+ {
+ System.out.println( Thread.currentThread().toString() + ", event = " + event + ", " + description );
+ }
+ }
+
+ private void print( String event, Failure description )
+ {
+ if ( printToConsole )
+ {
+ System.out.println( Thread.currentThread().toString() + ", event = " + event + ", " + description );
+ }
}
- public DiagnosticRunListener(boolean printToConsole, RunListener target) {
+ public DiagnosticRunListener( boolean printToConsole, RunListener target )
+ {
this.printToConsole = printToConsole;
this.target = target;
}
@Override
- public void testRunStarted(Description description) throws Exception {
- print("testRunStarted", description);
- if (target != null) target.testRunStarted( description);
+ public void testRunStarted( Description description )
+ throws Exception
+ {
+ print( "testRunStarted", description );
+ if ( target != null )
+ {
+ target.testRunStarted( description );
+ }
}
@Override
- public void testRunFinished(Result result) throws Exception {
- print("testRunFinished", result);
- if (target != null) target.testRunFinished( result);
-
+ public void testRunFinished( Result result )
+ throws Exception
+ {
+ print( "testRunFinished", result );
+ if ( target != null )
+ {
+ target.testRunFinished( result );
+ }
}
@Override
- public void testStarted(Description description) throws Exception {
+ public void testStarted( Description description )
+ throws Exception
+ {
numTestStarted.incrementAndGet();
- print("testStarted", description);
- if (target != null) target.testStarted( description);
+ print( "testStarted", description );
+ if ( target != null )
+ {
+ target.testStarted( description );
+ }
}
@Override
- public void testFinished(Description description) throws Exception {
+ public void testFinished( Description description )
+ throws Exception
+ {
numTestFinished.incrementAndGet();
- print("testFinished", description);
- if (target != null) target.testFinished( description);
+ print( "testFinished", description );
+ if ( target != null )
+ {
+ target.testFinished( description );
+ }
}
@Override
- public void testFailure(Failure failure) throws Exception {
+ public void testFailure( Failure failure )
+ throws Exception
+ {
numTestFailed.incrementAndGet();
- print("testFailure", failure);
- if (target != null) target.testFailure( failure);
+ print( "testFailure", failure );
+ if ( target != null )
+ {
+ target.testFailure( failure );
+ }
}
@Override
- public void testAssumptionFailure(Failure failure) {
+ public void testAssumptionFailure( Failure failure )
+ {
numTestAssumptionsFailed.incrementAndGet();
- print("testAssumptionFailure", failure);
- if (target != null) target.testAssumptionFailure( failure);
+ print( "testAssumptionFailure", failure );
+ if ( target != null )
+ {
+ target.testAssumptionFailure( failure );
+ }
}
@Override
- public void testIgnored(Description description) throws Exception {
+ public void testIgnored( Description description )
+ throws Exception
+ {
numTestIgnored.incrementAndGet();
- print("testIgnored", description);
- if (target != null) target.testIgnored( description);
+ print( "testIgnored", description );
+ if ( target != null )
+ {
+ target.testIgnored( description );
+ }
}
@Override
- public String toString() {
- return "DiagnosticRunListener{" +
- "numTestIgnored=" + numTestIgnored +
- ", numTestStarted=" + numTestStarted +
- ", numTestFailed=" + numTestFailed +
- ", numTestAssumptionsFailed=" + numTestAssumptionsFailed +
- ", numTestFinished=" + numTestFinished +
- '}';
+ public String toString()
+ {
+ return "DiagnosticRunListener{" + "numTestIgnored=" + numTestIgnored + ", numTestStarted=" + numTestStarted
+ + ", numTestFailed=" + numTestFailed + ", numTestAssumptionsFailed=" + numTestAssumptionsFailed
+ + ", numTestFinished=" + numTestFinished + '}';
}
}
Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java?rev=1225838&r1=1225837&r2=1225838&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java Fri Dec 30 15:08:51 2011
@@ -1,3 +1,5 @@
+package org.apache.maven.surefire.junitcore;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -16,8 +18,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.maven.surefire.junitcore;
-
import junit.framework.TestCase;
import org.junit.Test;
@@ -29,8 +29,8 @@ import static org.junit.Assert.*;
/*
* @author Kristian Rosenvold, kristian.rosenvold@gmail com
*/
-
-public class JUnitCoreParametersTest extends TestCase
+public class JUnitCoreParametersTest
+ extends TestCase
{
public void testIsParallelMethod()
throws Exception
Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListenerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListenerTest.java?rev=1225838&r1=1225837&r2=1225838&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListenerTest.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreRunListenerTest.java Fri Dec 30 15:08:51 2011
@@ -1,5 +1,24 @@
package org.apache.maven.surefire.junitcore;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import org.apache.maven.surefire.junit4.MockReporter;
import java.util.HashMap;
@@ -15,45 +34,46 @@ import org.junit.runner.notification.Run
/**
* @author Kristian Rosenvold
*/
-public class JUnitCoreRunListenerTest extends TestCase
+public class JUnitCoreRunListenerTest
+ extends TestCase
{
public void testTestRunStarted()
throws Exception
{
- RunListener jUnit4TestSetReporter = new JUnitCoreRunListener( new MockReporter( ) ,
- new HashMap<String, TestSet>( ) );
+ RunListener jUnit4TestSetReporter =
+ new JUnitCoreRunListener( new MockReporter(), new HashMap<String, TestSet>() );
JUnitCore core = new JUnitCore();
- core.addListener( jUnit4TestSetReporter );
- Result result = core.run( new Computer(), STest1.class, STest2.class);
- core.removeListener( jUnit4TestSetReporter );
- assertEquals(2, result.getRunCount());
+ core.addListener( jUnit4TestSetReporter );
+ Result result = core.run( new Computer(), STest1.class, STest2.class );
+ core.removeListener( jUnit4TestSetReporter );
+ assertEquals( 2, result.getRunCount() );
}
public void testFailedAssumption()
throws Exception
{
- RunListener jUnit4TestSetReporter = new JUnitCoreRunListener( new MockReporter( ) ,
- new HashMap<String, TestSet>( ) );
+ RunListener jUnit4TestSetReporter =
+ new JUnitCoreRunListener( new MockReporter(), new HashMap<String, TestSet>() );
JUnitCore core = new JUnitCore();
- core.addListener( jUnit4TestSetReporter );
- Result result = core.run( new Computer(), TestWithAssumptionFailure.class);
- core.removeListener( jUnit4TestSetReporter );
- assertEquals(1, result.getRunCount());
+ core.addListener( jUnit4TestSetReporter );
+ Result result = core.run( new Computer(), TestWithAssumptionFailure.class );
+ core.removeListener( jUnit4TestSetReporter );
+ assertEquals( 1, result.getRunCount() );
}
-
public static class STest1
{
@Test
- public void testSomething(){
-
+ public void testSomething()
+ {
}
}
+
public static class STest2
{
@Test
- public void testSomething2(){
-
+ public void testSomething2()
+ {
}
}
@@ -62,8 +82,7 @@ public class JUnitCoreRunListenerTest e
@Test
public void testSomething2()
{
- Assume.assumeTrue(false);
-
+ Assume.assumeTrue( false );
}
}
Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java?rev=1225838&r1=1225837&r2=1225838&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java Fri Dec 30 15:08:51 2011
@@ -1,3 +1,5 @@
+package org.apache.maven.surefire.junitcore;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -17,8 +19,6 @@
* under the License.
*/
-package org.apache.maven.surefire.junitcore;
-
import java.util.HashMap;
import java.util.concurrent.ExecutionException;
import org.apache.maven.plugin.surefire.report.FileReporterFactory;
@@ -69,8 +69,9 @@ public class JUnitCoreTester
final Result run = junitCore.run( computer, classes );
junitCore.removeListener( runListener );
reporterManagerFactory.close();
- if (computer instanceof ConfigurableParallelComputer){
- ((ConfigurableParallelComputer)computer).close();
+ if ( computer instanceof ConfigurableParallelComputer )
+ {
+ ( (ConfigurableParallelComputer) computer ).close();
}
return run;
}
Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java?rev=1225838&r1=1225837&r2=1225838&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java Fri Dec 30 15:08:51 2011
@@ -1,3 +1,5 @@
+package org.apache.maven.surefire.junitcore;
+
/*
* JBoss, Home of Professional Open Source
* Copyright 2009, Red Hat Middleware LLC, and individual contributors
@@ -14,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.maven.surefire.junitcore;
import java.io.File;
import java.util.ArrayList;
@@ -74,64 +75,82 @@ import org.junit.runners.model.Initializ
* @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
* @version $Revision: $
*/
-public class Surefire746Test {
+public class Surefire746Test
+{
@Test
- public void surefireIsConfused_ByMultipleIgnore_OnClassLevel() throws Exception {
- ReporterFactory reporterFactory = FileReporterFactory.defaultNoXml( );
- BaseProviderFactory providerParameters = new BaseProviderFactory(reporterFactory, true);
+ public void surefireIsConfused_ByMultipleIgnore_OnClassLevel()
+ throws Exception
+ {
+ ReporterFactory reporterFactory = FileReporterFactory.defaultNoXml();
+ BaseProviderFactory providerParameters = new BaseProviderFactory( reporterFactory, true );
ConsoleLogger consoleLogger = new DefaultConsoleReporter( System.out );
- providerParameters.setReporterConfiguration(new ReporterConfiguration(new File(""), false));
+ providerParameters.setReporterConfiguration( new ReporterConfiguration( new File( "" ), false ) );
Properties junitProps = new Properties();
- junitProps.put( ProviderParameterNames.PARALLEL_PROP, "none");
+ junitProps.put( ProviderParameterNames.PARALLEL_PROP, "none" );
- JUnitCoreParameters jUnitCoreParameters = new JUnitCoreParameters(junitProps);
+ JUnitCoreParameters jUnitCoreParameters = new JUnitCoreParameters( junitProps );
final Map<String, TestSet> testSetMap = new ConcurrentHashMap<String, TestSet>();
- RunListener listener = ConcurrentReporterManager.createInstance(testSetMap, reporterFactory, false, false, consoleLogger);
+ RunListener listener =
+ ConcurrentReporterManager.createInstance( testSetMap, reporterFactory, false, false, consoleLogger );
- TestsToRun testsToRun = new TestsToRun(Arrays.asList( TestClassTest.class ));
+ TestsToRun testsToRun = new TestsToRun( Arrays.<Class<?>>asList( TestClassTest.class ) );
- org.junit.runner.notification.RunListener jUnit4RunListener = new JUnitCoreRunListener(listener, testSetMap);
+ org.junit.runner.notification.RunListener jUnit4RunListener = new JUnitCoreRunListener( listener, testSetMap );
- List<org.junit.runner.notification.RunListener> customRunListeners = new ArrayList<org.junit.runner.notification.RunListener>();
- customRunListeners.add(0, jUnit4RunListener);
+ List<org.junit.runner.notification.RunListener> customRunListeners =
+ new ArrayList<org.junit.runner.notification.RunListener>();
+ customRunListeners.add( 0, jUnit4RunListener );
- JUnitCoreWrapper.execute(testsToRun, jUnitCoreParameters, customRunListeners, null);
+ JUnitCoreWrapper.execute( testsToRun, jUnitCoreParameters, customRunListeners, null );
RunResult result = reporterFactory.close();
- Assert.assertEquals("JUnit should report correctly number of test ran(Finished)", 1, result.getCompletedCount());
+ Assert.assertEquals( "JUnit should report correctly number of test ran(Finished)", 1,
+ result.getCompletedCount() );
}
- @RunWith(TestCaseRunner.class)
- public static class TestClassTest {
+ @RunWith( TestCaseRunner.class )
+ public static class TestClassTest
+ {
@Test
- public void shouldNeverBeCalled() throws Exception {
- Assert.assertTrue(true);
+ public void shouldNeverBeCalled()
+ throws Exception
+ {
+ Assert.assertTrue( true );
}
}
- public static class TestCaseRunner extends BlockJUnit4ClassRunner {
- public TestCaseRunner(Class<?> klass) throws InitializationError {
- super(klass);
+ public static class TestCaseRunner
+ extends BlockJUnit4ClassRunner
+ {
+ public TestCaseRunner( Class<?> klass )
+ throws InitializationError
+ {
+ super( klass );
}
@Override
- public void run(RunNotifier notifier) {
- notifier.addListener(new TestRunListener());
- super.run(notifier);
+ public void run( RunNotifier notifier )
+ {
+ notifier.addListener( new TestRunListener() );
+ super.run( notifier );
}
}
- private static class TestRunListener extends org.junit.runner.notification.RunListener {
+ private static class TestRunListener
+ extends org.junit.runner.notification.RunListener
+ {
@Override
- public void testFinished(Description description) throws Exception {
- throw new RuntimeException("This Exception will cause Surefire to receive a internal JUnit Description and fail");
+ public void testFinished( Description description )
+ throws Exception
+ {
+ throw new RuntimeException( "This Exception will cause Surefire to receive a internal JUnit Description and fail" );
}
}
}
\ No newline at end of file
Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire813IncorrectResultTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire813IncorrectResultTest.java?rev=1225838&r1=1225837&r2=1225838&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire813IncorrectResultTest.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire813IncorrectResultTest.java Fri Dec 30 15:08:51 2011
@@ -1,5 +1,24 @@
package org.apache.maven.surefire.junitcore;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import org.apache.maven.surefire.testset.TestSetFailedException;
@@ -17,46 +36,55 @@ import static junit.framework.Assert.ass
public class Surefire813IncorrectResultTest
{
-
@Test
public void dcount()
throws TestSetFailedException, ExecutionException
{
JUnitCoreTester jUnitCoreTester = new JUnitCoreTester();
final Result run = jUnitCoreTester.run( true, Test6.class );
- assertEquals(0, run.getFailureCount());
+ assertEquals( 0, run.getFailureCount() );
}
- public static class Test6 {
- private final CountDownLatch latch = new CountDownLatch( 1 );
+ public static class Test6
+ {
+ private final CountDownLatch latch = new CountDownLatch( 1 );
+
+ @Test
+ public void test61()
+ throws Exception
+ {
+ System.out.println( "Hey" );
+ }
+
+ @After
+ public void tearDown()
+ throws Exception
+ {
+ new MyThread().start();
+ latch.await();
+ }
+
+ private static final String s = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
- @Test
- public void test61() throws Exception {
- System.out.println("Hey");
- }
-
- @After
- public void tearDown() throws Exception {
- new MyThread().start();
- latch.await();
- }
-
- private static final String s = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
-
- public void synchPrint(){
- for (int i=0; i<1000; ++i){ // Increase this number if it does no fail
- System.out.println(i+":"+s);
+ public void synchPrint()
+ {
+ for ( int i = 0; i < 1000; ++i ) // Increase this number if it does no fail
+ {
+ System.out.println( i + ":" + s );
+ }
}
- }
- private class MyThread extends Thread {
- @Override
- public void run() {
- System.out.println(s);
- latch.countDown();
- synchPrint();
+ private class MyThread
+ extends Thread
+ {
+ @Override
+ public void run()
+ {
+ System.out.println( s );
+ latch.countDown();
+ synchPrint();
+ }
}
- }
}
}
Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java?rev=1225838&r1=1225837&r2=1225838&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java Fri Dec 30 15:08:51 2011
@@ -1,4 +1,5 @@
package org.apache.maven.surefire.junitcore;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file