Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arksap2002 committed Dec 12, 2023
1 parent e76dc77 commit e07ce88
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package org.jetbrains.research.testspark.display

import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import com.intellij.ui.JBColor
import org.jetbrains.research.testspark.TestSparkBundle
import org.jetbrains.research.testspark.TestSparkLabelsBundle
import org.jetbrains.research.testspark.services.TestCaseDisplayService
import org.jetbrains.research.testspark.services.TestsExecutionResultService
import java.awt.Dimension
import javax.swing.Box
import javax.swing.BoxLayout
Expand All @@ -15,7 +13,6 @@ import javax.swing.JCheckBox
import javax.swing.JLabel
import javax.swing.JOptionPane
import javax.swing.JPanel
import javax.swing.border.MatteBorder

class TopButtonsPanelFactory(private val project: Project) {
private var runAllButton: JButton = createRunAllTestButton()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,17 @@ class TestCaseDisplayService(private val project: Project) {
WriteCommandAction.runWriteCommandAction(project) {
descriptor.withFileFilter { file ->
file.isDirectory || (
file.extension?.lowercase(Locale.getDefault()) == "java" && (
PsiManager.getInstance(project).findFile(file!!) as PsiJavaFile
).classes.stream().map { it.name }
.toArray()
.contains(
(
PsiManager.getInstance(project)
.findFile(file) as PsiJavaFile
).name.removeSuffix(".java"),
)
file.extension?.lowercase(Locale.getDefault()) == "java" && (
PsiManager.getInstance(project).findFile(file!!) as PsiJavaFile
).classes.stream().map { it.name }
.toArray()
.contains(
(
PsiManager.getInstance(project)
.findFile(file) as PsiJavaFile
).name.removeSuffix(".java"),
)
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ class CoverageVisualisationServiceTest : LightJavaCodeInsightFixtureTestCase() {
// }

fun testCreateToolWindowTabTestSingleContent() {
coverageVisualisationService.showCoverage(Report(CompactReport(TestGenerationResultImpl())), myEditor)
coverageVisualisationService.showCoverage(Report(CompactReport(TestGenerationResultImpl())))
val toolWindow = ToolWindowManager.getInstance(project).getToolWindow("TestSpark")!!

// Verify only 1 content is created
assertThat(toolWindow.contentManager.contents.size).isEqualTo(1)
}

fun testCreateToolWindowTabTestContent() {
coverageVisualisationService.showCoverage(Report(CompactReport(TestGenerationResultImpl())), myEditor)
coverageVisualisationService.showCoverage(Report(CompactReport(TestGenerationResultImpl())))
val toolWindow = ToolWindowManager.getInstance(project).getToolWindow("TestSpark")!!
val content = toolWindow.contentManager.getContent(0)!!
assertThat(content.displayName).isEqualTo("Coverage")
Expand Down

0 comments on commit e07ce88

Please sign in to comment.