spock-mockable icon indicating copy to clipboard operation
spock-mockable copied to clipboard

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

Open mimkorn opened this issue 1 year ago • 0 comments

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.

mimkorn avatar Sep 11 '23 13:09 mimkorn