Skip to content

StaticMockHandler not found when calling a static method on a spied object #382

Open
@mimkorn

Description

@mimkorn

I get

Caused by: java.lang.NoClassDefFoundError: io/github/joke/spockmockable/agent/StaticMockHandler
	at java.base/java.time.LocalDateTime.of(LocalDateTime.java:374)
	at java.base/java.time.LocalDateTime.<clinit>(LocalDateTime.java:144)
	at jdk.zipfs/jdk.nio.zipfs.ZipUtils.dosToJavaTime(ZipUtils.java:118)
	....

when running this minimal test:

import spock.lang.Specification
import java.time.LocalDateTime

class ExperimentSpecTest extends Specification {

    def "test"() {
        def of = LocalDateTime.of(2023, 1, 2, 3, 4)
        def spyTime = Spy(LocalDateTime)
    }
}

Using Spock 2.1, spock-mockable 2.3.2

The order of calls does not matter.

The whole test execution crashes, so no tests run at all with that failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions