diff --git a/idea/resources/inspectionDescriptions/SimplifyAssertNotNull.html b/idea/resources/inspectionDescriptions/SimplifyAssertNotNull.html new file mode 100644 index 00000000000..0abb9f857f8 --- /dev/null +++ b/idea/resources/inspectionDescriptions/SimplifyAssertNotNull.html @@ -0,0 +1,6 @@ + + +This inspection detects an 'assert' calls that check that a variable declared above has non-null value. +Such asserts can be replaced with use of '!!' or '?:' operator in the variable initializer. + + diff --git a/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/after.kt.template b/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/after.kt.template new file mode 100644 index 00000000000..08d451cc0de --- /dev/null +++ b/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/after.kt.template @@ -0,0 +1 @@ +val v = something()!! diff --git a/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/before.kt.template b/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/before.kt.template new file mode 100644 index 00000000000..4cde255db35 --- /dev/null +++ b/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/before.kt.template @@ -0,0 +1,2 @@ +val v = something() +assert(v != null) diff --git a/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/description.html b/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/description.html new file mode 100644 index 00000000000..97c6492320f --- /dev/null +++ b/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/description.html @@ -0,0 +1,6 @@ + + +This intention replaces an 'assert' call which checks that a variable declared above has non-null value +with use of '!!' or '?:' operator in the variable initializer. + + \ No newline at end of file diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 761e0047e5a..6b08d8cc820 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -636,6 +636,11 @@ Kotlin + + org.jetbrains.kotlin.idea.intentions.SimplifyAssertNotNullIntention + Kotlin + + org.jetbrains.kotlin.idea.intentions.ImportMemberIntention Kotlin @@ -1163,6 +1168,13 @@ level="INFO" /> + + (SimplifyAssertNotNullIntention()) + +class SimplifyAssertNotNullIntention : SelfTargetingOffsetIndependentIntention( + KtCallExpression::class.java, + "Replace assert with '!!' or '?:'" +) { + override fun isApplicableTo(element: KtCallExpression): Boolean { + if ((element.calleeExpression as? KtNameReferenceExpression)?.getReferencedName() != "assert") return false + + val arguments = element.valueArguments + if (arguments.size != 1 && arguments.size != 2) return false + + val condition = arguments.first().getArgumentExpression() as? KtBinaryExpression ?: return false + if (condition.operationToken != KtTokens.EXCLEQ) return false + val value = condition.expressionComparedToNull() as? KtNameReferenceExpression ?: return false + + val prevDeclaration = findVariableDeclaration(element) ?: return false + if (value.getReferencedNameAsName() != prevDeclaration.nameAsName) return false + if (prevDeclaration.initializer == null) return false + + val bindingContext = element.analyze(BodyResolveMode.PARTIAL) + val resolvedCall = element.getResolvedCall(bindingContext) ?: return false + if (!resolvedCall.isReallySuccess()) return false + val function = resolvedCall.resultingDescriptor as? FunctionDescriptor ?: return false + if (function.importableFqName?.asString() != "kotlin.assert") return false + + if (arguments.size == 1) { + this.text = "Replace with '!!' operator" + } + else { + if (extractMessage(element) == null) return false + this.text = "Replace with '?: error(...)'" + } + return true + } + + override fun applyTo(element: KtCallExpression, editor: Editor?) { + val declaration = findVariableDeclaration(element)!! + val initializer = declaration.initializer!! + val message = extractMessage(element) + + val commentSaver = CommentSaver(element) + + if (message == null) { + val newInitializer = KtPsiFactory(element).createExpressionByPattern("$0!!", initializer) + initializer.replace(newInitializer) + } + else { + val newInitializer = KtPsiFactory(element).createExpressionByPattern("$0 ?: kotlin.error($1)", initializer, message) + val result = initializer.replace(newInitializer) + + val qualifiedExpression = (result as KtBinaryExpression).right as KtDotQualifiedExpression + ShortenReferences.DEFAULT.process(element.getContainingKtFile(), + qualifiedExpression.startOffset, + (qualifiedExpression.selectorExpression as KtCallExpression).calleeExpression!!.endOffset) + } + + element.delete() + + commentSaver.restore(declaration) + + if (editor != null) { + val newInitializer = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(declaration).initializer!! + val offset = if (message == null) + newInitializer.endOffset + else + (newInitializer as KtBinaryExpression).operationReference.startOffset + editor.moveCaret(offset) + } + } + + private fun findVariableDeclaration(element: KtCallExpression): KtVariableDeclaration? { + if (element.parent !is KtBlockExpression) return null + return element.siblings(forward = false, withItself = false).firstIsInstanceOrNull() as? KtVariableDeclaration + } + + private fun extractMessage(element: KtCallExpression): KtExpression? { + val arguments = element.valueArguments + if (arguments.size != 2) return null + return (arguments[1].getArgumentExpression() as? KtLambdaExpression) + ?.bodyExpression + ?.statements + ?.singleOrNull() + } +} diff --git a/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt b/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt index 2aac1eac529..6d985e3d7cc 100644 --- a/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt +++ b/idea/src/org/jetbrains/kotlin/idea/j2k/J2kPostProcessings.kt @@ -66,6 +66,7 @@ object J2KPostProcessingRegistrar { registerIntentionBasedProcessing(AnonymousFunctionToLambdaIntention()) { applyTo(it) } registerIntentionBasedProcessing(RemoveUnnecessaryParenthesesIntention()) { applyTo(it) } registerIntentionBasedProcessing(SimplifyForIntention()) { applyTo(it) } + registerIntentionBasedProcessing(SimplifyAssertNotNullIntention()) { applyTo(it, null) } registerDiagnosticBasedProcessing(Errors.USELESS_CAST) { element, diagnostic -> val expression = RemoveUselessCastFix.invoke(element) diff --git a/idea/testData/intentions/simplifyAssertNotNull/.intention b/idea/testData/intentions/simplifyAssertNotNull/.intention new file mode 100644 index 00000000000..06bd9d61394 --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/.intention @@ -0,0 +1 @@ +org.jetbrains.kotlin.idea.intentions.SimplifyAssertNotNullIntention diff --git a/idea/testData/intentions/simplifyAssertNotNull/comments.kt b/idea/testData/intentions/simplifyAssertNotNull/comments.kt new file mode 100644 index 00000000000..97ee68dcb2b --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/comments.kt @@ -0,0 +1,8 @@ +// INTENTION_TEXT: "Replace with '?: error(...)'" +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0] + // now let's check it for null + assert(v != null /* null */, /* lazy message */ { "Should be not null" }) // 'v' should not be null +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/comments.kt.after b/idea/testData/intentions/simplifyAssertNotNull/comments.kt.after new file mode 100644 index 00000000000..2298b23f8e6 --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/comments.kt.after @@ -0,0 +1,8 @@ +// INTENTION_TEXT: "Replace with '?: error(...)'" +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0] ?: error(/* null */ /* lazy message */"Should be not null") + // now let's check it for null + // 'v' should not be null +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt b/idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt new file mode 100644 index 00000000000..a8e76a29ece --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt @@ -0,0 +1,8 @@ +// INTENTION_TEXT: "Replace with '!!' operator" +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0] + // now let's check it for null + assert(v != null /* null */) // 'v' should not be null +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt.after b/idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt.after new file mode 100644 index 00000000000..e5621582c9b --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt.after @@ -0,0 +1,8 @@ +// INTENTION_TEXT: "Replace with '!!' operator" +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0]!!/* null */ + // now let's check it for null + // 'v' should not be null +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/complicatedMessageLambda.kt b/idea/testData/intentions/simplifyAssertNotNull/complicatedMessageLambda.kt new file mode 100644 index 00000000000..324f0acd8aa --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/complicatedMessageLambda.kt @@ -0,0 +1,7 @@ +// IS_APPLICABLE: false +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0] + assert(v != null, { val t = 1; "Should be not null: $t" }) +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/eqNull.kt b/idea/testData/intentions/simplifyAssertNotNull/eqNull.kt new file mode 100644 index 00000000000..bddbd813648 --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/eqNull.kt @@ -0,0 +1,7 @@ +// IS_APPLICABLE: false +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0] + assert(v == null) +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt b/idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt new file mode 100644 index 00000000000..863a68c9d49 --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt @@ -0,0 +1,11 @@ +// INTENTION_TEXT: "Replace with '?: error(...)'" +// WITH_RUNTIME + +class C { + fun error(message: String) { } + + fun foo(p: Array) { + val v = p[0] + assert(v != null) { "message" } + } +} diff --git a/idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt.after b/idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt.after new file mode 100644 index 00000000000..3cf63493336 --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt.after @@ -0,0 +1,10 @@ +// INTENTION_TEXT: "Replace with '?: error(...)'" +// WITH_RUNTIME + +class C { + fun error(message: String) { } + + fun foo(p: Array) { + val v = p[0] ?: kotlin.error("message") + } +} diff --git a/idea/testData/intentions/simplifyAssertNotNull/falseAssert.kt b/idea/testData/intentions/simplifyAssertNotNull/falseAssert.kt new file mode 100644 index 00000000000..5c73e4e31fb --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/falseAssert.kt @@ -0,0 +1,11 @@ +// IS_APPLICABLE: false +// WITH_RUNTIME + +class C { + fun assert(b: Boolean) { } + + fun foo(p: Array) { + val v = p[0] + assert(v != null) + } +} diff --git a/idea/testData/intentions/simplifyAssertNotNull/noMessage.kt b/idea/testData/intentions/simplifyAssertNotNull/noMessage.kt new file mode 100644 index 00000000000..777ffc44220 --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/noMessage.kt @@ -0,0 +1,7 @@ +// INTENTION_TEXT: "Replace with '!!' operator" +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0] + assert(v != null) +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/noMessage.kt.after b/idea/testData/intentions/simplifyAssertNotNull/noMessage.kt.after new file mode 100644 index 00000000000..d9ef8b5993f --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/noMessage.kt.after @@ -0,0 +1,6 @@ +// INTENTION_TEXT: "Replace with '!!' operator" +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0]!! +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/otherVariable.kt b/idea/testData/intentions/simplifyAssertNotNull/otherVariable.kt new file mode 100644 index 00000000000..17668c35e1e --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/otherVariable.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: false +// WITH_RUNTIME + +fun foo(p: Array) { + val v1 = p[0] + val v2 = p[1] + assert(v1 != null) +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/qualifiedAccess.kt b/idea/testData/intentions/simplifyAssertNotNull/qualifiedAccess.kt new file mode 100644 index 00000000000..5c4c1f00b6e --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/qualifiedAccess.kt @@ -0,0 +1,9 @@ +// IS_APPLICABLE: false +// WITH_RUNTIME + +class C(val v: String?) { + fun foo(p: Array) { + val v = p[0] + assert(this.v != null) + } +} diff --git a/idea/testData/intentions/simplifyAssertNotNull/withMessage.kt b/idea/testData/intentions/simplifyAssertNotNull/withMessage.kt new file mode 100644 index 00000000000..af6bca3cf26 --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/withMessage.kt @@ -0,0 +1,7 @@ +// INTENTION_TEXT: "Replace with '?: error(...)'" +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0] + assert(v != null, { "Should be not null" }) +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/withMessage.kt.after b/idea/testData/intentions/simplifyAssertNotNull/withMessage.kt.after new file mode 100644 index 00000000000..0a6eca3fc23 --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/withMessage.kt.after @@ -0,0 +1,6 @@ +// INTENTION_TEXT: "Replace with '?: error(...)'" +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0] ?: error("Should be not null") +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt b/idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt new file mode 100644 index 00000000000..01040ce59c6 --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt @@ -0,0 +1,7 @@ +// INTENTION_TEXT: "Replace with '?: error(...)'" +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0] + assert(v != null) { "Should be not null" } +} \ No newline at end of file diff --git a/idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt.after b/idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt.after new file mode 100644 index 00000000000..0a6eca3fc23 --- /dev/null +++ b/idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt.after @@ -0,0 +1,6 @@ +// INTENTION_TEXT: "Replace with '?: error(...)'" +// WITH_RUNTIME + +fun foo(p: Array) { + val v = p[0] ?: error("Should be not null") +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index d37e90bb350..11467eea4c4 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -7925,6 +7925,81 @@ public class IntentionTestGenerated extends AbstractIntentionTest { } } + @TestMetadata("idea/testData/intentions/simplifyAssertNotNull") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SimplifyAssertNotNull extends AbstractIntentionTest { + public void testAllFilesPresentInSimplifyAssertNotNull() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/simplifyAssertNotNull"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true); + } + + @TestMetadata("comments.kt") + public void testComments() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/comments.kt"); + doTest(fileName); + } + + @TestMetadata("commentsNoMessage.kt") + public void testCommentsNoMessage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt"); + doTest(fileName); + } + + @TestMetadata("complicatedMessageLambda.kt") + public void testComplicatedMessageLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/complicatedMessageLambda.kt"); + doTest(fileName); + } + + @TestMetadata("eqNull.kt") + public void testEqNull() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/eqNull.kt"); + doTest(fileName); + } + + @TestMetadata("errorFunctionInContext.kt") + public void testErrorFunctionInContext() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt"); + doTest(fileName); + } + + @TestMetadata("falseAssert.kt") + public void testFalseAssert() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/falseAssert.kt"); + doTest(fileName); + } + + @TestMetadata("noMessage.kt") + public void testNoMessage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/noMessage.kt"); + doTest(fileName); + } + + @TestMetadata("otherVariable.kt") + public void testOtherVariable() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/otherVariable.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedAccess.kt") + public void testQualifiedAccess() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/qualifiedAccess.kt"); + doTest(fileName); + } + + @TestMetadata("withMessage.kt") + public void testWithMessage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/withMessage.kt"); + doTest(fileName); + } + + @TestMetadata("withMessageLambdaOutside.kt") + public void testWithMessageLambdaOutside() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt"); + doTest(fileName); + } + } + @TestMetadata("idea/testData/intentions/simplifyBooleanWithConstants") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/j2k/testData/fileOrElement/assertStatement/assertNotNull.java b/j2k/testData/fileOrElement/assertStatement/assertNotNull.java new file mode 100644 index 00000000000..6d77420aa8a --- /dev/null +++ b/j2k/testData/fileOrElement/assertStatement/assertNotNull.java @@ -0,0 +1,13 @@ +abstract class C { + void foo() { + String s1 = f(); + assert s1 != null; + + String s2 = g(); + assert s2 != null : "g should not return null"; + int h = s2.hashCode(); + } + + abstract void f(): String; + abstract void g(): String; +} \ No newline at end of file diff --git a/j2k/testData/fileOrElement/assertStatement/assertNotNull.kt b/j2k/testData/fileOrElement/assertStatement/assertNotNull.kt new file mode 100644 index 00000000000..c59c8840802 --- /dev/null +++ b/j2k/testData/fileOrElement/assertStatement/assertNotNull.kt @@ -0,0 +1,11 @@ +internal abstract class C { + fun foo() { + val s1 = f()!! + + val s2 = g() ?: error("g should not return null") + val h = s2.hashCode() + } + + internal abstract fun f() + internal abstract fun g() +} diff --git a/j2k/tests/org/jetbrains/kotlin/j2k/JavaToKotlinConverterForWebDemoTestGenerated.java b/j2k/tests/org/jetbrains/kotlin/j2k/JavaToKotlinConverterForWebDemoTestGenerated.java index 1541a02ef11..3a8094806fb 100644 --- a/j2k/tests/org/jetbrains/kotlin/j2k/JavaToKotlinConverterForWebDemoTestGenerated.java +++ b/j2k/tests/org/jetbrains/kotlin/j2k/JavaToKotlinConverterForWebDemoTestGenerated.java @@ -316,6 +316,12 @@ public class JavaToKotlinConverterForWebDemoTestGenerated extends AbstractJavaTo KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("j2k/testData/fileOrElement/assertStatement"), Pattern.compile("^(.+)\\.java$"), true); } + @TestMetadata("assertNotNull.java") + public void testAssertNotNull() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/assertStatement/assertNotNull.java"); + doTest(fileName); + } + @TestMetadata("onlyCondition.java") public void testOnlyCondition() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/assertStatement/onlyCondition.java"); diff --git a/j2k/tests/org/jetbrains/kotlin/j2k/JavaToKotlinConverterSingleFileTestGenerated.java b/j2k/tests/org/jetbrains/kotlin/j2k/JavaToKotlinConverterSingleFileTestGenerated.java index 6d412c8377f..a357c9814f1 100644 --- a/j2k/tests/org/jetbrains/kotlin/j2k/JavaToKotlinConverterSingleFileTestGenerated.java +++ b/j2k/tests/org/jetbrains/kotlin/j2k/JavaToKotlinConverterSingleFileTestGenerated.java @@ -316,6 +316,12 @@ public class JavaToKotlinConverterSingleFileTestGenerated extends AbstractJavaTo KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("j2k/testData/fileOrElement/assertStatement"), Pattern.compile("^(.+)\\.java$"), true); } + @TestMetadata("assertNotNull.java") + public void testAssertNotNull() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/assertStatement/assertNotNull.java"); + doTest(fileName); + } + @TestMetadata("onlyCondition.java") public void testOnlyCondition() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/assertStatement/onlyCondition.java");