Keep Mockito versions in sync; small fixes after JUnit 5 migration

This commit is contained in:
ljacqu 2023-12-21 17:27:19 +01:00
parent 13087f7322
commit 6161d95f56
4 changed files with 17 additions and 6 deletions

View File

@ -212,7 +212,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<version>0.8.11</version>
<executions>
<execution>
<id>pre-unit-test</id>
@ -1039,7 +1039,7 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
<version>2.27.0</version>
<version>4.11.0</version>
</dependency>
<!-- Required to mock the LuckPerms API-->

View File

@ -120,8 +120,8 @@ class ConsoleLoggerTest {
@Test
void shouldLogStackTraceToFile() throws IOException {
// given
Settings settings = newSettings(true, LogLevel.INFO);
settings.getProperty(PluginSettings.LOG_LEVEL); // dummy code to avoid Mockito from complaining about the log level being stubbed
Settings settings = mock(Settings.class);
given(settings.getProperty(SecuritySettings.USE_LOGGING)).willReturn(true);
ConsoleLogger.initializeSharedSettings(settings);
Exception e = new IllegalStateException("Test exception message");

View File

@ -120,9 +120,20 @@ public final class TestHelper {
.willAnswer(invocation -> ((Property<?>) invocation.getArgument(0)).getDefaultValue());
}
/**
* Creates a file with the given name in the provided folder. Throws an exception if the file
* could not be created.
*
* @param folder the folder to create the file in
* @param filename the name of the file to create
* @return the created file
*/
public static File createFile(File folder, String filename) throws IOException {
File file = new File(folder, filename);
file.createNewFile();
boolean created = file.createNewFile();
if (!created) {
throw new IllegalStateException("Could not create file '" + filename + "' in " + folder);
}
return file;
}
}

View File

@ -16,7 +16,7 @@ import static org.mockito.Mockito.mock;
class PlayerUtilsTest {
@BeforeAll
static void setAuthmeInstance() {
static void setUpLogger() {
TestHelper.setupLogger();
}