Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-56 remove easymock and use mockito #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ plugins {
group = providers.gradleProperty("pluginGroup").get()
version = providers.gradleProperty("pluginVersion").get()

// Set the JVM language level used to build the project.
kotlin {
jvmToolchain(17)
}

// Configure project's dependencies
repositories {
mavenCentral()

Expand All @@ -32,14 +30,10 @@ repositories {
}
}

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
testImplementation(libs.junit)
testImplementation(libs.mockk)
testImplementation(libs.groovy)

// TODO: use Mockito!
testImplementation("org.easymock:easymock:5.5.0")
testImplementation(libs.mockito)

// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
intellijPlatform {
Expand Down
7 changes: 1 addition & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@ qodana = "2024.3.4"

[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
mockk = { group = "io.mockk", name = "mockk", version = "1.13.16" }
mockito-core = { group = "org.mockito", name = "mockito-core", version = "5.15.2" }
mockito-inline = { group = "org.mockito", name = "mockito-inline", version = "5.2.0" }
mockito = { group = "org.mockito", name = "mockito-core", version = "4.11.0" }
groovy = { group = "org.codehaus.groovy", name = "groovy-test", version = "3.0.23" } # update if you can!

[bundles]
mockito = ["mockito-core", "mockito-inline"]

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" }
Expand Down
1 change: 0 additions & 1 deletion src/main/kotlin/com/akefirad/groom/spock/SpockSpecUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import kotlin.contracts.contract
object SpockSpecUtils {
private const val SPOCK_SPEC_CLASS: String = "spock.lang.Specification"

@JvmStatic
fun PsiFile.hasAnySpecification(): Boolean {
return this is GroovyFile && children
.filterIsInstance<PsiClass>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import com.intellij.psi.PsiJavaFile
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixture4TestCase
import org.junit.Test

import static com.akefirad.oss.easymock.EasyMock.mock
import static org.easymock.EasyMock.expect
import static org.easymock.EasyMock.replay
import static org.easymock.EasyMock.verify
import static org.mockito.Mockito.mock
import static org.mockito.Mockito.verify
import static org.mockito.Mockito.when

class GroovyFoldingBuilderTest extends LightPlatformCodeInsightFixture4TestCase {

Expand All @@ -30,8 +29,7 @@ class GroovyFoldingBuilderTest extends LightPlatformCodeInsightFixture4TestCase
// given:
def subject = new GroovyFoldingBuilder()
def root = mock(PsiJavaFile)
expect(root.node).andReturn(null)
replay(root)
when(root.node).thenReturn(null)

// when:
def result = subject.buildFoldRegions(root, mock(Document), false)
Expand All @@ -40,21 +38,20 @@ class GroovyFoldingBuilderTest extends LightPlatformCodeInsightFixture4TestCase
assert result.length == 0

// and:
verify(root)
verify(root).node
}

@Test
void 'getLanguagePlaceholderText should fail when node is not GrListOrMap'() {
// given:
def subject = new GroovyFoldingBuilder()
def node = mock(ASTNode)
expect(node.getPsi()).andReturn(mock(PsiElement))
replay(node)
when(node.psi).thenReturn(mock(PsiElement))

// expect:
assertThrows(IllegalStateException) { subject.getLanguagePlaceholderText(node, TextRange.EMPTY_RANGE) }

// and:
verify(node)
verify(node).psi
}
}
7 changes: 0 additions & 7 deletions src/test/groovy/com/akefirad/oss/easymock/EasyMock.groovy

This file was deleted.

Loading