SUREFIRE-954: a test case.

Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/5c740ff3
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/5c740ff3
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/5c740ff3

Branch: refs/heads/surefire-954-test
Commit: 5c740ff3a8de8b4a1ef542dc9f4e03be2fd74cdc
Parents: 18ac0e2
Author: Benson Margulies <bmargul...@gmail.com>
Authored: Tue Jan 29 20:05:07 2013 +0000
Committer: Benson Margulies <bmargul...@gmail.com>
Committed: Tue Jan 29 20:05:07 2013 +0000

----------------------------------------------------------------------
 .../surefire/its/Junit4BeforeClassExceptionIT.java |   42 +++++++++++++++
 .../BaseClassWithBeforeClassThatThrows.java        |   32 +++++++++++
 .../BeforeClassExceptionTest.java                  |   33 +++++++++++
 3 files changed, 107 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/5c740ff3/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4BeforeClassExceptionIT.java
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4BeforeClassExceptionIT.java
 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4BeforeClassExceptionIT.java
new file mode 100644
index 0000000..0b50980
--- /dev/null
+++ 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4BeforeClassExceptionIT.java
@@ -0,0 +1,42 @@
+package org.apache.maven.surefire.its;
+
+/*
+ * 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.its.fixture.SurefireIntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+
+/**
+ * Test JUnit 4 tests with a @BeforeClass that throws.
+ *
+ */
+public class Junit4BeforeClassExceptionIT
+    extends SurefireIntegrationTestCase
+{
+    public void testJunit4BeforeClassException()
+    {
+        // Todo: Support assumption failure == ignore for junit4
+        unpack().executeTest().verifyErrorFreeLog().assertTestSuiteResults( 1, 
0, 1, 0 );
+    }
+
+    private SurefireLauncher unpack()
+    {
+        return unpack( "/junit-before-class-exception" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/5c740ff3/surefire-integration-tests/src/test/resources/junit-before-class-exception/src/test/java/junit/beforeClassException/BaseClassWithBeforeClassThatThrows.java
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/resources/junit-before-class-exception/src/test/java/junit/beforeClassException/BaseClassWithBeforeClassThatThrows.java
 
b/surefire-integration-tests/src/test/resources/junit-before-class-exception/src/test/java/junit/beforeClassException/BaseClassWithBeforeClassThatThrows.java
new file mode 100644
index 0000000..847a371
--- /dev/null
+++ 
b/surefire-integration-tests/src/test/resources/junit-before-class-exception/src/test/java/junit/beforeClassException/BaseClassWithBeforeClassThatThrows.java
@@ -0,0 +1,32 @@
+package junit.beforeClassException;
+
+/*
+ * 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.
+ */
+
+/**
+ * A class with a BeforeClass that throws.
+ */
+public class BaseClassWithBeforeClassThatThrows {
+
+    static Object nullPointerObject;
+
+    public static void baseBeforeClass() {
+        nullPointerObject.notify();
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/5c740ff3/surefire-integration-tests/src/test/resources/junit-before-class-exception/src/test/java/junit/beforeClassException/BeforeClassExceptionTest.java
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/resources/junit-before-class-exception/src/test/java/junit/beforeClassException/BeforeClassExceptionTest.java
 
b/surefire-integration-tests/src/test/resources/junit-before-class-exception/src/test/java/junit/beforeClassException/BeforeClassExceptionTest.java
new file mode 100644
index 0000000..9961736
--- /dev/null
+++ 
b/surefire-integration-tests/src/test/resources/junit-before-class-exception/src/test/java/junit/beforeClassException/BeforeClassExceptionTest.java
@@ -0,0 +1,33 @@
+package junit.beforeClassException;
+
+/*
+ * 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.junit.Test;
+
+/**
+ * Class to exercise the problem.
+ */
+public class BeforeClassExceptionTest extends 
BaseClassWithBeforeClassThatThrows {
+
+    @Test
+    public void notVeryInteresting() {
+        // empty
+    }
+}

Reply via email to