mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-21 05:44:17 +00:00
Updated to Mockito 5.3.1
This commit is contained in:
parent
280ee1f75c
commit
1f86c847e2
2 changed files with 5 additions and 5 deletions
2
pom.xml
2
pom.xml
|
@ -106,7 +106,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>3.12.4</version>
|
<version>5.3.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -16,7 +16,7 @@ public final class TestServer {
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
TestServer server = new TestServer();
|
TestServer server = new TestServer();
|
||||||
Server instance = Mockito.mock(Server.class);
|
Server instance = Mockito.mock(Mockito.withSettings().stubOnly());
|
||||||
|
|
||||||
Mockito.when(instance.isPrimaryThread()).then(mock -> Thread.currentThread().equals(server.creatingThread));
|
Mockito.when(instance.isPrimaryThread()).then(mock -> Thread.currentThread().equals(server.creatingThread));
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public final class TestServer {
|
||||||
private final Map<NamespacedKey, Keyed> cache = new HashMap<>();
|
private final Map<NamespacedKey, Keyed> cache = new HashMap<>();
|
||||||
@Override
|
@Override
|
||||||
public Keyed get(NamespacedKey key) {
|
public Keyed get(NamespacedKey key) {
|
||||||
return cache.computeIfAbsent(key, key2 -> Mockito.mock(aClass));
|
return cache.computeIfAbsent(key, key2 -> Mockito.mock(aClass, Mockito.withSettings().stubOnly()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,13 +55,13 @@ public final class TestServer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
UnsafeValues unsafeValues = Mockito.mock(UnsafeValues.class);
|
UnsafeValues unsafeValues = Mockito.mock(Mockito.withSettings().stubOnly());
|
||||||
|
|
||||||
Mockito.when(unsafeValues.createLegacyMaterial(Mockito.any(), Mockito.anyInt(), Mockito.anyInt(), Mockito.anyShort(), Mockito.any())).then(new Answer<Object>() {
|
Mockito.when(unsafeValues.createLegacyMaterial(Mockito.any(), Mockito.anyInt(), Mockito.anyInt(), Mockito.anyShort(), Mockito.any())).then(new Answer<Object>() {
|
||||||
Map<String, Material> materials = new HashMap<>();
|
Map<String, Material> materials = new HashMap<>();
|
||||||
@Override
|
@Override
|
||||||
public Object answer(InvocationOnMock invocationOnMock) {
|
public Object answer(InvocationOnMock invocationOnMock) {
|
||||||
return materials.computeIfAbsent(invocationOnMock.getArgument(0), name -> Mockito.mock(Material.class, name));
|
return materials.computeIfAbsent(invocationOnMock.getArgument(0), name -> Mockito.mock(Material.class, Mockito.withSettings().name(name).stubOnly()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue