Skip to content

Commit 5a4e264

Browse files
authored
Merge pull request #393 from BentoBoxWorld/mockito5
Mockito5
2 parents c13774c + b58e621 commit 5a4e264

File tree

13 files changed

+1079
-687
lines changed

13 files changed

+1079
-687
lines changed

pom.xml

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@
5252
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
5353
<java.version>21</java.version>
5454
<!-- Non-minecraft related dependencies -->
55-
<powermock.version>2.0.9</powermock.version>
55+
<junit.version>5.10.2</junit.version>
56+
<mockito.version>5.11.0</mockito.version>
57+
<mock-bukkit.version>v1.21-SNAPSHOT</mock-bukkit.version>
5658
<!-- More visible way how to change dependency versions -->
57-
<spigot.version>1.21.5-R0.1-SNAPSHOT</spigot.version>
58-
<bentobox.version>3.7.4</bentobox.version>
59+
<paper.version>1.21.10-R0.1-SNAPSHOT</paper.version>
60+
<bentobox.version>3.10.2</bentobox.version>
5961
<!-- Warps addon version -->
6062
<warps.version>1.12.0</warps.version>
6163
<!-- Visit addon version -->
@@ -67,7 +69,7 @@
6769
<!-- Do not change unless you want different name for local builds. -->
6870
<build.number>-LOCAL</build.number>
6971
<!-- This allows to change between versions. -->
70-
<build.version>2.22.1</build.version>
72+
<build.version>2.23.0</build.version>
7173
<sonar.projectKey>BentoBoxWorld_Level</sonar.projectKey>
7274
<sonar.organization>bentobox-world</sonar.organization>
7375
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
@@ -124,24 +126,24 @@
124126

125127
<repositories>
126128
<repository>
127-
<id>spigot-repo</id>
128-
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
129+
<id>jitpack.io</id>
130+
<url>https://jitpack.io</url>
129131
</repository>
130132
<repository>
131-
<id>codemc</id>
132-
<url>https://repo.codemc.org/repository/maven-snapshots/</url>
133+
<id>codemc-repo</id>
134+
<url>https://repo.codemc.org/repository/maven-public</url>
133135
</repository>
134136
<repository>
135-
<id>codemc-repo</id>
136-
<url>https://repo.codemc.org/repository/maven-public/</url>
137+
<id>papermc</id>
138+
<url>https://repo.papermc.io/repository/maven-public/</url>
137139
</repository>
138140
<repository>
139-
<id>bentoboxworld</id>
140-
<url>https://repo.codemc.org/repository/bentoboxworld/</url>
141+
<id>codemc</id>
142+
<url>https://repo.codemc.org/repository/maven-snapshots/</url>
141143
</repository>
142144
<repository>
143-
<id>jitpack.io</id>
144-
<url>https://jitpack.io</url>
145+
<id>bentoboxworld</id>
146+
<url>https://repo.codemc.org/repository/bentoboxworld/</url>
145147
</repository>
146148
<!--Wild Stacker repo -->
147149
<repository>
@@ -172,36 +174,49 @@
172174
</repositories>
173175

174176
<dependencies>
175-
<!-- Spigot API -->
177+
<!-- Mock Bukkit - used to mock the server in tests -->
176178
<dependency>
177-
<groupId>org.spigotmc</groupId>
178-
<artifactId>spigot-api</artifactId>
179-
<version>${spigot.version}</version>
180-
<scope>provided</scope>
181-
</dependency>
182-
<!-- Mockito (Unit testing) -->
179+
<groupId>com.github.MockBukkit</groupId>
180+
<artifactId>MockBukkit</artifactId>
181+
<version>${mock-bukkit.version}</version>
182+
<scope>test</scope>
183+
</dependency>
184+
<!-- Mockito (Unit testing) This goes at the top to ensure the dependencies are accurate. -->
185+
<dependency>
186+
<groupId>org.junit.jupiter</groupId>
187+
<artifactId>junit-jupiter-api</artifactId>
188+
<version>${junit.version}</version>
189+
<scope>test</scope>
190+
</dependency>
191+
<dependency>
192+
<groupId>org.junit.jupiter</groupId>
193+
<artifactId>junit-jupiter-engine</artifactId>
194+
<version>${junit.version}</version>
195+
<scope>test</scope>
196+
</dependency>
197+
<dependency>
198+
<groupId>org.mockito</groupId>
199+
<artifactId>mockito-junit-jupiter</artifactId>
200+
<version>5.11.0</version>
201+
<scope>test</scope>
202+
</dependency>
183203
<dependency>
184204
<groupId>org.mockito</groupId>
185205
<artifactId>mockito-core</artifactId>
186-
<version>3.11.1</version>
206+
<version>${mockito.version}</version>
187207
<scope>test</scope>
188208
</dependency>
209+
<!-- Paper API -->
189210
<dependency>
190-
<groupId>org.powermock</groupId>
191-
<artifactId>powermock-module-junit4</artifactId>
192-
<version>${powermock.version}</version>
193-
<scope>test</scope>
194-
</dependency>
195-
<dependency>
196-
<groupId>org.powermock</groupId>
197-
<artifactId>powermock-api-mockito2</artifactId>
198-
<version>${powermock.version}</version>
199-
<scope>test</scope>
211+
<groupId>io.papermc.paper</groupId>
212+
<artifactId>paper-api</artifactId>
213+
<version>${paper.version}</version>
214+
<scope>provided</scope>
200215
</dependency>
201216
<dependency>
202217
<groupId>world.bentobox</groupId>
203218
<artifactId>bentobox</artifactId>
204-
<version>3.7.4-SNAPSHOT</version>
219+
<version>3.10.0</version>
205220
</dependency>
206221
<dependency>
207222
<groupId>world.bentobox</groupId>
@@ -354,18 +369,19 @@
354369
<plugin>
355370
<groupId>org.apache.maven.plugins</groupId>
356371
<artifactId>maven-compiler-plugin</artifactId>
357-
<version>3.13.0</version>
372+
<version>3.14.1</version>
358373
<configuration>
359374
<release>${java.version}</release>
360375
</configuration>
361376
</plugin>
362377
<plugin>
363378
<groupId>org.apache.maven.plugins</groupId>
364379
<artifactId>maven-surefire-plugin</artifactId>
365-
<version>3.5.2</version>
380+
<version>3.5.4</version>
366381
<configuration>
367382
<argLine>
368383
${argLine}
384+
-XX:+EnableDynamicAgentLoading
369385
--add-opens java.base/java.lang=ALL-UNNAMED
370386
--add-opens java.base/java.math=ALL-UNNAMED
371387
--add-opens java.base/java.io=ALL-UNNAMED
@@ -478,7 +494,7 @@
478494
<plugin>
479495
<groupId>org.jacoco</groupId>
480496
<artifactId>jacoco-maven-plugin</artifactId>
481-
<version>0.8.10</version>
497+
<version>0.8.13</version>
482498
<configuration>
483499
<append>true</append>
484500
<excludes>

src/main/java/world/bentobox/level/LevelsManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public LevelsManager(Level addon) {
5757
// Set up the database handler to store and retrieve data
5858
// Note that these are saved by the BentoBox database
5959
handler = new Database<>(addon, IslandLevels.class);
60+
6061
// Initialize the cache
6162
levelsCache = new HashMap<>();
6263
// Initialize top ten lists
@@ -237,7 +238,6 @@ private long getNumBlocks(final long initialLevel) throws ParseException, IOExce
237238
*
238239
* @param world - world where the island is
239240
* @param targetPlayer - target player UUID
240-
* @param ownerOnly - return level only if the target player is the owner
241241
* @return Level of the player's island or zero if player is unknown or UUID is
242242
* null
243243
*/
@@ -492,7 +492,6 @@ public void setInitialIslandCount(@NonNull Island island, long lv) {
492492
* member
493493
*
494494
* @param world - world
495-
* @param island - island
496495
* @param lv - level
497496
*/
498497
public void setIslandLevel(@NonNull World world, @NonNull UUID targetPlayer, long lv) {

src/main/java/world/bentobox/level/calculators/Results.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public long getInitialCount() {
173173
}
174174

175175
/**
176-
* @param long1 the initialCount to set
176+
* @param count the initialCount to set
177177
*/
178178
public void setInitialCount(Long count) {
179179
this.initialCount.set(count);

src/main/java/world/bentobox/level/config/BlockConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public Integer getValue(World world, Object obj) {
240240

241241
/**
242242
* Return true if the block should be hidden
243-
* @param m block material or entity type of spawner
243+
* @param obj object that can be a material or string
244244
* @return true if hidden
245245
*/
246246
public boolean isHiddenBlock(Object obj) {
@@ -254,7 +254,7 @@ public boolean isHiddenBlock(Object obj) {
254254

255255
/**
256256
* Return true if the block should not be hidden
257-
* @param m block material
257+
* @param obj object that can be a material or string
258258
* @return false if hidden
259259
*/
260260
public boolean isNotHiddenBlock(Object obj) {

0 commit comments

Comments
 (0)