MyProjectService.kt: introduce dummy method to visualise code coverage

This commit is contained in:
Jakub Chrzanowski 2022-09-20 14:53:39 +02:00 committed by Jakub Chrzanowski
parent d76e7494cc
commit 7de60b2524
2 changed files with 15 additions and 2 deletions

View File

@ -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
}

View File

@ -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<MyProjectService>()
assertEquals(4, projectService.getRandomNumber())
}
override fun getTestDataPath() = "src/test/testData/rename"
}