Skip to content

Commit c103586

Browse files
Update dependency org.mockito:mockito-core to v5.21.0
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
1 parent 5681cb7 commit c103586

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ junit6 = '6.0.1'
1111
junitPlatformVersionRange = "[1.12,7)"
1212
asm = '9.9'
1313
mockito4 = '4.11.0'
14-
mockito5 = '5.20.0'
14+
mockito5 = '5.21.0'
1515
workflows-kotlin = "2.2.21"
1616

1717
[libraries]

spock-specs/src/test/groovy/org/spockframework/mock/runtime/mockito/MockitoMockMakerSpec.groovy

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@ package org.spockframework.mock.runtime.mockito
1919
import org.mockito.MockMakers
2020
import org.mockito.Mockito
2121
import org.mockito.exceptions.base.MockitoException
22-
import org.spockframework.mock.CannotCreateMockException
23-
import org.spockframework.mock.MockUtil
24-
import org.spockframework.mock.runtime.ByteBuddyTestClassLoader
25-
import org.spockframework.runtime.GroovyRuntimeUtil
2622
import spock.lang.Issue
2723
import spock.lang.Requires
2824
import spock.lang.Specification
2925
import spock.mock.DetachedMockFactory
26+
import spock.util.environment.Jvm
3027

3128
import java.lang.reflect.Proxy
3229
import java.util.concurrent.Callable
3330

31+
import org.spockframework.mock.CannotCreateMockException
32+
import org.spockframework.mock.MockUtil
33+
import org.spockframework.mock.runtime.ByteBuddyTestClassLoader
34+
import org.spockframework.runtime.GroovyRuntimeUtil
35+
3436
import static spock.mock.MockMakers.mockito
3537

3638
@SuppressWarnings("GroovyAssignabilityCheck")
@@ -442,12 +444,17 @@ Can not mock final classes with the following settings :
442444
}
443445

444446
def "Class is not mockable sample for asking org.mockito.plugins.MockMaker.isTypeMockable"() {
447+
given:
448+
def expectedMessage = Jvm.current.java8
449+
? "Cannot create mock for class java.lang.Class. mockito: Cannot mock wrapper types, String.class or Class.class"
450+
: "Cannot create mock for class java.lang.Class. mockito: Cannot mock primitive wrapper types, String, Class, or WeakReference"
451+
445452
when:
446453
Mock(mockMaker: mockito, Class)
447454

448455
then:
449456
CannotCreateMockException ex = thrown()
450-
ex.message == "Cannot create mock for class java.lang.Class. mockito: Cannot mock wrapper types, String.class or Class.class"
457+
ex.message == expectedMessage
451458
}
452459

453460
def "mockito mock setting without mockito settings shall not fail"() {

0 commit comments

Comments
 (0)