Updated Branches: refs/heads/master fbeb76e98 -> f7cb5fd4b
o Extracted test classes to separate files to stabilize line numbers Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/f7cb5fd4 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/f7cb5fd4 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/f7cb5fd4 Branch: refs/heads/master Commit: f7cb5fd4bec3e0005c33085f85e809c7e323edde Parents: fbeb76e Author: Kristian Rosenvold <krosenv...@apache.org> Authored: Fri Dec 21 02:37:06 2012 +0100 Committer: Kristian Rosenvold <krosenv...@apache.org> Committed: Fri Dec 21 02:37:06 2012 +0100 ---------------------------------------------------------------------- .../surefire/report/ADifferen0tTestClass.java | 25 ++++ .../maven/surefire/report/AssertionNoMessage.java | 31 +++++ .../maven/surefire/report/CaseThatWillFail.java | 31 +++++ .../apache/maven/surefire/report/FailWithFail.java | 31 +++++ .../maven/surefire/report/InnerATestClass.java | 42 +++++++ .../surefire/report/SmartStackTraceParserTest.java | 90 +-------------- .../apache/maven/surefire/report/TestClass1.java | 42 +++++++ .../apache/maven/surefire/report/TestClass2.java | 31 +++++ 8 files changed, 239 insertions(+), 84 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f7cb5fd4/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/ADifferen0tTestClass.java ---------------------------------------------------------------------- diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/ADifferen0tTestClass.java b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/ADifferen0tTestClass.java new file mode 100644 index 0000000..3b58a81 --- /dev/null +++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/ADifferen0tTestClass.java @@ -0,0 +1,25 @@ +package org.apache.maven.surefire.report; + +/* + * 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. + */ + + +class ADifferen0tTestClass +{ +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f7cb5fd4/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/AssertionNoMessage.java ---------------------------------------------------------------------- diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/AssertionNoMessage.java b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/AssertionNoMessage.java new file mode 100644 index 0000000..7c1e3a3 --- /dev/null +++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/AssertionNoMessage.java @@ -0,0 +1,31 @@ +package org.apache.maven.surefire.report; + +/* + * 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; + +class AssertionNoMessage + extends TestCase +{ + public void testThrowSomething() + { + assertEquals( "abc", "xyz" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f7cb5fd4/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/CaseThatWillFail.java ---------------------------------------------------------------------- diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/CaseThatWillFail.java b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/CaseThatWillFail.java new file mode 100644 index 0000000..dc31fbb --- /dev/null +++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/CaseThatWillFail.java @@ -0,0 +1,31 @@ +package org.apache.maven.surefire.report; + +/* + * 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; + +class CaseThatWillFail + extends TestCase +{ + public void testThatWillFail() + { + assertEquals( "abc", "def" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f7cb5fd4/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/FailWithFail.java ---------------------------------------------------------------------- diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/FailWithFail.java b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/FailWithFail.java new file mode 100644 index 0000000..4acfe1b --- /dev/null +++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/FailWithFail.java @@ -0,0 +1,31 @@ +package org.apache.maven.surefire.report; + +/* + * 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; + +class FailWithFail + extends TestCase +{ + public void testThatWillFail() + { + fail( "abc" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f7cb5fd4/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/InnerATestClass.java ---------------------------------------------------------------------- diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/InnerATestClass.java b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/InnerATestClass.java new file mode 100644 index 0000000..c85d230 --- /dev/null +++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/InnerATestClass.java @@ -0,0 +1,42 @@ +package org.apache.maven.surefire.report; + +/* + * 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.Assert; + +/** +* Created with IntelliJ IDEA. +* User: kristian +* Date: 12/21/12 +* Time: 2:32 AM +* To change this template use File | Settings | File Templates. +*/ +class InnerATestClass +{ + public static void testFake() + { + innerMethod(); + } + + private static void innerMethod() + { + Assert.assertTrue( false ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f7cb5fd4/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java ---------------------------------------------------------------------- diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java index 4dccdd8..ef42c6a 100644 --- a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java +++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java @@ -30,84 +30,6 @@ public class SmartStackTraceParserTest extends TestCase { - static class AssertionNoMessage - extends TestCase - { - public void testThrowSomething() - { - assertEquals( "abc", "xyz" ); - } - } - - static class ADifferen0tTestClass - { - static class InnerATestClass - { - public static void testFake() - { - innerMethod(); - } - - private static void innerMethod() - { - Assert.assertTrue( false ); - } - } - } - - static class CaseThatWillFail - extends TestCase - { - public void testThatWillFail() - { - assertEquals( "abc", "def" ); - } - } - - static class TestClass2 - { - static class InnerCTestClass - { - public static void cThrows() - throws Exception - { - throw new Exception( "Hey ho, hey ho, a throwable we throw!" ); - } - } - } - - static class TestClass1 - { - static class InnerBTestClass - { - public static void throwSomething() - { - innerThrowSomething(); - } - - public static void innerThrowSomething() - { - try - { - TestClass2.InnerCTestClass.cThrows(); - } - catch ( Exception e ) - { - throw new RuntimeException( e ); - } - } - } - } - - static class FailWithFail - extends TestCase - { - public void testThatWillFail() - { - fail( "abc" ); - } - } - public void testGetString() throws Exception { @@ -223,7 +145,7 @@ public class SmartStackTraceParserTest { SmartStackTraceParser smartStackTraceParser = new SmartStackTraceParser( CaseThatWillFail.class, e ); String res = smartStackTraceParser.getString(); - assertEquals( "SmartStackTraceParserTest$CaseThatWillFail.testThatWillFail:64 expected:<abc> but was:<def>", + assertEquals( "CaseThatWillFail.testThatWillFail:29 expected:<abc> but was:<def>", res ); } } @@ -266,7 +188,7 @@ public class SmartStackTraceParserTest SmartStackTraceParser smartStackTraceParser = new SmartStackTraceParser( AssertionNoMessage.class, e ); String res = smartStackTraceParser.getString(); assertEquals( - "SmartStackTraceParserTest$AssertionNoMessage.testThrowSomething:39 expected:<abc> but was:<xyz>", + "AssertionNoMessage.testThrowSomething:29 expected:<abc> but was:<xyz>", res ); } } @@ -282,7 +204,7 @@ public class SmartStackTraceParserTest SmartStackTraceParser smartStackTraceParser = new SmartStackTraceParser( FailWithFail.class, e ); String res = smartStackTraceParser.getString(); assertEquals( - "SmartStackTraceParserTest$FailWithFail.testThatWillFail:108 abc", + "FailWithFail.testThatWillFail:29 abc", res ); } } @@ -291,18 +213,18 @@ public class SmartStackTraceParserTest { try { - ADifferen0tTestClass.InnerATestClass.testFake(); + InnerATestClass.testFake(); } catch ( Throwable t ) { List<StackTraceElement> stackTraceElements = SmartStackTraceParser.focusInsideClass( t.getStackTrace(), - ADifferen0tTestClass.InnerATestClass.class.getName() ); + InnerATestClass.class.getName() ); assertNotNull( stackTraceElements ); assertEquals( 5, stackTraceElements.size() ); StackTraceElement innerMost = stackTraceElements.get( 0 ); assertEquals( Assert.class.getName(), innerMost.getClassName() ); StackTraceElement outer = stackTraceElements.get( 4 ); - assertEquals( ADifferen0tTestClass.InnerATestClass.class.getName(), outer.getClassName() ); + assertEquals( InnerATestClass.class.getName(), outer.getClassName() ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f7cb5fd4/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/TestClass1.java ---------------------------------------------------------------------- diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/TestClass1.java b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/TestClass1.java new file mode 100644 index 0000000..5b34f67 --- /dev/null +++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/TestClass1.java @@ -0,0 +1,42 @@ +package org.apache.maven.surefire.report; + +/* + * 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. + */ +class TestClass1 +{ + static class InnerBTestClass + { + public static void throwSomething() + { + innerThrowSomething(); + } + + public static void innerThrowSomething() + { + try + { + TestClass2.InnerCTestClass.cThrows(); + } + catch ( Exception e ) + { + throw new RuntimeException( e ); + } + } + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/f7cb5fd4/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/TestClass2.java ---------------------------------------------------------------------- diff --git a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/TestClass2.java b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/TestClass2.java new file mode 100644 index 0000000..ae55026 --- /dev/null +++ b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/TestClass2.java @@ -0,0 +1,31 @@ +package org.apache.maven.surefire.report; + +/* + * 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. + */ +class TestClass2 +{ + static class InnerCTestClass + { + public static void cThrows() + throws Exception + { + throw new Exception( "Hey ho, hey ho, a throwable we throw!" ); + } + } +}