diff --git a/pom.xml b/pom.xml index 6639cde3f..c4fc52348 100644 --- a/pom.xml +++ b/pom.xml @@ -1013,33 +1013,27 @@ org.junit.jupiter junit-jupiter-engine test - 5.7.1 + 5.10.1 org.junit.jupiter junit-jupiter-params test - 5.7.1 + 5.10.1 org.hamcrest - java-hamcrest + hamcrest test - 2.0.0.0 + 2.2 org.mockito mockito-core test - 4.8.1 - - - hamcrest-core - org.hamcrest - - + 4.11.0 org.mockito diff --git a/src/test/java/fr/xephi/authme/api/v3/AuthMeApiTest.java b/src/test/java/fr/xephi/authme/api/v3/AuthMeApiTest.java index d5786729c..938b8b22b 100644 --- a/src/test/java/fr/xephi/authme/api/v3/AuthMeApiTest.java +++ b/src/test/java/fr/xephi/authme/api/v3/AuthMeApiTest.java @@ -243,9 +243,12 @@ class AuthMeApiTest { } @Test - public void testGetLastLoginMillis() { - AuthMeApi result = AuthMeApi.getInstance(); - assertThat(result.getLastLoginTime("notAPlayer"), nullValue()); + void shouldReturnNullLastLoginForUnknownPlayer() { + // given / when + Instant result = api.getLastLoginTime("notAPlayer"); + + // then + assertThat(result, nullValue()); } @Test diff --git a/src/test/java/fr/xephi/authme/data/limbo/persistence/LimboPersistenceTest.java b/src/test/java/fr/xephi/authme/data/limbo/persistence/LimboPersistenceTest.java index 25da46af5..d0eed99bf 100644 --- a/src/test/java/fr/xephi/authme/data/limbo/persistence/LimboPersistenceTest.java +++ b/src/test/java/fr/xephi/authme/data/limbo/persistence/LimboPersistenceTest.java @@ -59,7 +59,7 @@ class LimboPersistenceTest { void setUpMocks() { given(settings.getProperty(LimboSettings.LIMBO_PERSISTENCE_TYPE)).willReturn(LimboPersistenceType.DISABLED); given(handlerFactory.newInstance(any(Class.class))) - .willAnswer(invocation -> mock(invocation.getArgument(0))); + .willAnswer(invocation -> mock((Class) invocation.getArgument(0))); } @Test diff --git a/src/test/java/fr/xephi/authme/service/GeoIpServiceTest.java b/src/test/java/fr/xephi/authme/service/GeoIpServiceTest.java index a4f458407..eee47a3be 100644 --- a/src/test/java/fr/xephi/authme/service/GeoIpServiceTest.java +++ b/src/test/java/fr/xephi/authme/service/GeoIpServiceTest.java @@ -120,7 +120,7 @@ class GeoIpServiceTest { } @Test - public void shouldNotLookUpCountryNameIfDisabled() throws Exception { + void shouldNotLookUpCountryNameIfDisabled() throws Exception { // given InetAddress ip = InetAddress.getByName("24.45.167.89"); given(settings.getProperty(ProtectionSettings.ENABLE_GEOIP)).willReturn(false); diff --git a/src/test/java/fr/xephi/authme/settings/SettingsWarnerTest.java b/src/test/java/fr/xephi/authme/settings/SettingsWarnerTest.java index 1187f8d9a..0e1a68aa5 100644 --- a/src/test/java/fr/xephi/authme/settings/SettingsWarnerTest.java +++ b/src/test/java/fr/xephi/authme/settings/SettingsWarnerTest.java @@ -1,6 +1,5 @@ package fr.xephi.authme.settings; -import fr.xephi.authme.AuthMe; import fr.xephi.authme.TestHelper; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.service.BukkitService; @@ -60,7 +59,8 @@ class SettingsWarnerTest { } @Test - public void shouldWarnBungeeWithoutSpigot() { + void shouldWarnBungeeWithoutSpigot() { + // given Logger logger = TestHelper.setupLogger(); // this cannot be covered above, because it's conflicting with the other settings @@ -81,6 +81,7 @@ class SettingsWarnerTest { @Test void shouldNotLogAnyWarning() { + // given Logger logger = TestHelper.setupLogger(); given(settings.getProperty(RestrictionSettings.FORCE_SINGLE_SESSION)).willReturn(true); given(settings.getProperty(EmailSettings.SMTP_PORT)).willReturn(25);