From 7de60b252433ef5ea4e617a08ad0b28667c19aa6 Mon Sep 17 00:00:00 2001 From: Jakub Chrzanowski Date: Tue, 20 Sep 2022 14:53:39 +0200 Subject: [PATCH] MyProjectService.kt: introduce dummy method to visualise code coverage --- .../plugins/template/services/MyProjectService.kt | 5 +++++ .../org/jetbrains/plugins/template/MyPluginTest.kt | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/jetbrains/plugins/template/services/MyProjectService.kt b/src/main/kotlin/org/jetbrains/plugins/template/services/MyProjectService.kt index 175818d..1a84306 100644 --- a/src/main/kotlin/org/jetbrains/plugins/template/services/MyProjectService.kt +++ b/src/main/kotlin/org/jetbrains/plugins/template/services/MyProjectService.kt @@ -11,4 +11,9 @@ class MyProjectService(project: Project) { System.getenv("CI") ?: TODO("Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.") } + + /** + * Chosen by fair dice roll, guaranteed to be random. + */ + fun getRandomNumber() = 4 } diff --git a/src/test/kotlin/org/jetbrains/plugins/template/MyPluginTest.kt b/src/test/kotlin/org/jetbrains/plugins/template/MyPluginTest.kt index e8e0d59..ecbab8c 100644 --- a/src/test/kotlin/org/jetbrains/plugins/template/MyPluginTest.kt +++ b/src/test/kotlin/org/jetbrains/plugins/template/MyPluginTest.kt @@ -1,10 +1,12 @@ package org.jetbrains.plugins.template import com.intellij.ide.highlighter.XmlFileType +import com.intellij.openapi.components.service import com.intellij.psi.xml.XmlFile import com.intellij.testFramework.TestDataPath import com.intellij.testFramework.fixtures.BasePlatformTestCase import com.intellij.util.PsiErrorElementUtil +import org.jetbrains.plugins.template.services.MyProjectService @TestDataPath("\$CONTENT_ROOT/src/test/testData") class MyPluginTest : BasePlatformTestCase() { @@ -23,9 +25,15 @@ class MyPluginTest : BasePlatformTestCase() { } } - override fun getTestDataPath() = "src/test/testData/rename" - fun testRename() { myFixture.testRename("foo.xml", "foo_after.xml", "a2") } + + fun testProjectService() { + val projectService = project.service() + + assertEquals(4, projectService.getRandomNumber()) + } + + override fun getTestDataPath() = "src/test/testData/rename" }