diff options
author | Evgeny Mandrikov <Godin@users.noreply.github.com> | 2017-01-04 12:15:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-04 12:15:07 +0200 |
commit | c78b2bfdf73d68dbf9caa44e10cec9ac66bab3be (patch) | |
tree | 93f95abcedbabf3b7fc018561e0244fe15b5a560 /org.jacoco.core.test | |
parent | 34cd880f4e52a32b9f88ed4ea687b8f3f892395b (diff) | |
download | jacoco-c78b2bfdf73d68dbf9caa44e10cec9ac66bab3be.tar.gz |
Add missing test case that is described in documentation (#475)
Diffstat (limited to 'org.jacoco.core.test')
-rw-r--r-- | org.jacoco.core.test/src/org/jacoco/core/test/validation/ExceptionsTest.java | 10 | ||||
-rw-r--r-- | org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/Target03.java | 10 |
2 files changed, 17 insertions, 3 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/ExceptionsTest.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/ExceptionsTest.java index 5406e566..87fe3b6b 100644 --- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/ExceptionsTest.java +++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/ExceptionsTest.java @@ -27,9 +27,15 @@ public class ExceptionsTest extends ValidationTestBase { @Test public void testCoverageResult() { - // 1. Implicit Exception + // 0. Implicit NullPointerException // Currently no coverage at all, as we don't see when a block aborts // somewhere in the middle. + assertLine("implicitNullPointerException.before", ICounter.NOT_COVERED); + assertLine("implicitNullPointerException.exception", + ICounter.NOT_COVERED); + assertLine("implicitNullPointerException.after", ICounter.NOT_COVERED); + + // 1. Implicit Exception assertLine("implicitException.before", ICounter.FULLY_COVERED); assertLine("implicitException.exception", ICounter.NOT_COVERED); assertLine("implicitException.after", ICounter.NOT_COVERED); @@ -45,8 +51,6 @@ public class ExceptionsTest extends ValidationTestBase { assertLine("noExceptionTryCatch.catchBlock", ICounter.NOT_COVERED); // 4. Try/Catch Block With Exception Thrown Implicitly - // As always with implicit exceptions we don't see when a block aborts - // somewhere in the middle. assertLine("implicitExceptionTryCatch.beforeBlock", ICounter.FULLY_COVERED); assertLine("implicitExceptionTryCatch.before", ICounter.FULLY_COVERED); diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/Target03.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/Target03.java index 567e5e29..abb0129a 100644 --- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/Target03.java +++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/targets/Target03.java @@ -25,6 +25,10 @@ public class Target03 { public static void main(String[] args) { try { + implicitNullPointerException(null); + } catch (NullPointerException e) { + } + try { implicitException(); } catch (StubException e) { } @@ -47,6 +51,12 @@ public class Target03 { } } + private static void implicitNullPointerException(int[] a) { + nop(); // $line-implicitNullPointerException.before$ + a[0] = 0; // $line-implicitNullPointerException.exception$ + nop(); // $line-implicitNullPointerException.after$ + } + private static void implicitException() { nop(); // $line-implicitException.before$ ex(); // $line-implicitException.exception$ |