mirror of
				https://github.com/JetBrains/intellij-platform-plugin-template.git
				synced 2025-06-13 13:04:09 +00:00 
			
		
		
		
	MyProjectService.kt: introduce dummy method to visualise code coverage
This commit is contained in:
		
							parent
							
								
									d76e7494cc
								
							
						
					
					
						commit
						7de60b2524
					
				| @ -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 | ||||
| } | ||||
|  | ||||
| @ -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" | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user