aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core.test.validation.kotlin
diff options
context:
space:
mode:
authorEvgeny Mandrikov <138671+Godin@users.noreply.github.com>2019-01-08 20:47:27 +0100
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2019-01-08 20:47:27 +0100
commit45efe1ec7a8f182e5d80a89ce306f8958b047140 (patch)
treefb53f1b023f56cb97b072f2f94cc84efb63fe4f5 /org.jacoco.core.test.validation.kotlin
parent2458e8a4e467a5afc376b56a4e487ac54de0158e (diff)
downloadjacoco-45efe1ec7a8f182e5d80a89ce306f8958b047140.tar.gz
Add filter for Kotlin not-null assertion operator (#815)
Diffstat (limited to 'org.jacoco.core.test.validation.kotlin')
-rw-r--r--org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/KotlinNotNullOperatorTest.java26
-rw-r--r--org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinNotNullOperatorTarget.kt32
2 files changed, 58 insertions, 0 deletions
diff --git a/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/KotlinNotNullOperatorTest.java b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/KotlinNotNullOperatorTest.java
new file mode 100644
index 00000000..d2fb7162
--- /dev/null
+++ b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/KotlinNotNullOperatorTest.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation.kotlin;
+
+import org.jacoco.core.test.validation.ValidationTestBase;
+import org.jacoco.core.test.validation.kotlin.targets.KotlinNotNullOperatorTarget;
+
+/**
+ * Test of not-null assertion operator.
+ */
+public class KotlinNotNullOperatorTest extends ValidationTestBase {
+
+ public KotlinNotNullOperatorTest() {
+ super(KotlinNotNullOperatorTarget.class);
+ }
+
+}
diff --git a/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinNotNullOperatorTarget.kt b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinNotNullOperatorTarget.kt
new file mode 100644
index 00000000..23681de4
--- /dev/null
+++ b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinNotNullOperatorTarget.kt
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation.kotlin.targets
+
+/**
+ * Test target for not-null assertion operator.
+ */
+object KotlinNotNullOperatorTarget {
+
+ private fun example(x: String?): Int {
+ return x!!.length // assertFullyCovered()
+ }
+
+ @JvmStatic
+ fun main(args: Array<String>) {
+ example("")
+ try {
+ example(null)
+ } catch (e: NullPointerException) {
+ }
+ }
+
+}