You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2011/11/16 20:55:52 UTC

svn commit: r1202863 - in /maven/surefire/trunk/surefire-providers/surefire-junit47/src: main/java/org/apache/maven/surefire/junitcore/TestMethod.java test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java

Author: krosenvold
Date: Wed Nov 16 19:55:52 2011
New Revision: 1202863

URL: http://svn.apache.org/viewvc?rev=1202863&view=rev
Log:
[SUREFIRE-791] Negative run-time on failure

Fixed with unit test

Added:
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java   (with props)
Modified:
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java?rev=1202863&r1=1202862&r2=1202863&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java Wed Nov 16 19:55:52 2011
@@ -69,6 +69,7 @@ class TestMethod
     public void testFailure( ReportEntry failure )
     {
         this.testFailure = failure;
+        setEndTime();
     }
 
     public void testError( ReportEntry failure )

Added: 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=1202863&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java (added)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java Wed Nov 16 19:55:52 2011
@@ -0,0 +1,41 @@
+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 junit.framework.TestCase;
+import org.apache.maven.surefire.report.ReportEntry;
+import org.apache.maven.surefire.report.SimpleReportEntry;
+
+/**
+ * @author Kristian Rosenvold
+ */
+public class TestMethodTest
+    extends TestCase
+{
+    public void testTestFailure()
+        throws Exception
+    {
+        ReportEntry reportEntry = new SimpleReportEntry( "a", "b" );
+        TestMethod testMethod = new TestMethod( reportEntry );
+        testMethod.testFailure( reportEntry );
+        final int elapsed = testMethod.getElapsed();
+        assertTrue( elapsed >= 0 );
+        assertTrue( elapsed < 100000 );
+    }
+}

Propchange: maven/surefire/trunk/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java
------------------------------------------------------------------------------
    svn:eol-style = native