Updated Branches: refs/heads/master 6085acec2 -> c8a1b8145
o Made class more reformatting-proof Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/c8a1b814 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/c8a1b814 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/c8a1b814 Branch: refs/heads/master Commit: c8a1b8145c42f69e99ed378bbe85368a773811af Parents: 6085ace Author: Kristian Rosenvold <krosenv...@apache.org> Authored: Thu Dec 20 16:20:20 2012 +0100 Committer: Kristian Rosenvold <krosenv...@apache.org> Committed: Thu Dec 20 16:20:20 2012 +0100 ---------------------------------------------------------------------- .../surefire/report/SmartStackTraceParserTest.java | 158 ++++++++------- 1 files changed, 83 insertions(+), 75 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c8a1b814/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 03dd5e4..d332fd2 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 @@ -28,6 +28,76 @@ import junit.framework.TestCase; 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 ); + } + } + } + } + public void testGetString() throws Exception { @@ -143,67 +213,8 @@ public class SmartStackTraceParserTest { SmartStackTraceParser smartStackTraceParser = new SmartStackTraceParser( CaseThatWillFail.class, e ); String res = smartStackTraceParser.getString(); - assertEquals( "SmartStackTraceParserTest$CaseThatWillFail.testThatWillFail:170 expected:<abc> but was:<def>", res ); - } - } - - 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 ); - } - } + assertEquals( "SmartStackTraceParserTest$CaseThatWillFail.testThatWillFail:62 expected:<abc> but was:<def>", + res ); } } @@ -234,13 +245,19 @@ public class SmartStackTraceParserTest assertEquals( TestClass1.InnerBTestClass.class.getName(), outer.getClassName() ); } - public void testAssertionWithNoMessage(){ - try { - new AssertionNoMessage().testThrowSomething(); - } catch(ComparisonFailure e){ + public void testAssertionWithNoMessage() + { + try + { + new AssertionNoMessage().testThrowSomething(); + } + catch ( ComparisonFailure e ) + { SmartStackTraceParser smartStackTraceParser = new SmartStackTraceParser( AssertionNoMessage.class, e ); String res = smartStackTraceParser.getString(); - assertEquals( "SmartStackTraceParserTest$AssertionNoMessage.testThrowSomething:270 expected:<abc> but was:<xyz>", res ); + assertEquals( + "SmartStackTraceParserTest$AssertionNoMessage.testThrowSomething:37 expected:<abc> but was:<xyz>", + res ); } } @@ -263,13 +280,4 @@ public class SmartStackTraceParserTest } } - static class AssertionNoMessage - extends TestCase - { - public void testThrowSomething() - { - assertEquals( "abc", "xyz" ); - } - } - }