From 53f0a0cb37b56c5d8eb9391ca10c9d905c7a348e Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 4 Jun 2023 10:31:52 -0700 Subject: [PATCH 1/6] Fixed TryToComplete test class --- .../challenges/tasks/TryToCompleteTest.java | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/test/java/world/bentobox/challenges/tasks/TryToCompleteTest.java b/src/test/java/world/bentobox/challenges/tasks/TryToCompleteTest.java index 07d18e6..bc326bc 100644 --- a/src/test/java/world/bentobox/challenges/tasks/TryToCompleteTest.java +++ b/src/test/java/world/bentobox/challenges/tasks/TryToCompleteTest.java @@ -254,7 +254,7 @@ public class TryToCompleteTest { // ItemFactory ItemFactory itemFactory = mock(ItemFactory.class); when(Bukkit.getItemFactory()).thenReturn(itemFactory); - + // ChatColor PowerMockito.mockStatic(ChatColor.class, Mockito.RETURNS_MOCKS); when(ChatColor.stripColor(anyString())).thenAnswer((Answer) invocation -> invocation.getArgument(0, String.class)); @@ -282,7 +282,7 @@ public class TryToCompleteTest { public void testCompleteChallengesAddonUserChallengeWorldStringStringNotDeployed() { challenge.setDeployed(false); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.errors.not-deployed"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.not-deployed")); } /** @@ -292,7 +292,7 @@ public class TryToCompleteTest { public void testCompleteChallengesAddonUserChallengeWorldStringStringWrongWorld() { challenge.setUniqueId("test"); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("general.errors.wrong-world"); + verify(user).getTranslation(any(World.class), eq("general.errors.wrong-world")); } /** @@ -303,7 +303,7 @@ public class TryToCompleteTest { ChallengesAddon.CHALLENGES_WORLD_PROTECTION.setSetting(world, true); when(im.locationIsOnIsland(any(Player.class), any(Location.class))).thenReturn(false); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.errors.not-on-island"); + verify(user).getTranslation(any(World.class), eq("challenges.messages.not-on-island")); } /** @@ -314,7 +314,7 @@ public class TryToCompleteTest { ChallengesAddon.CHALLENGES_WORLD_PROTECTION.setSetting(world, false); when(im.locationIsOnIsland(any(Player.class), any(Location.class))).thenReturn(false); assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name"); + verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"), eq("name")); } /** @@ -324,7 +324,7 @@ public class TryToCompleteTest { public void testCompleteChallengesAddonUserChallengeWorldStringStringLevelNotUnlocked() { when(cm.isLevelUnlocked(any(), any(), any())).thenReturn(false); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.errors.challenge-level-not-available"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.challenge-level-not-available")); } /** @@ -335,7 +335,7 @@ public class TryToCompleteTest { challenge.setRepeatable(false); when(cm.isChallengeComplete(any(User.class), any(), any())).thenReturn(true); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.errors.not-repeatable"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.not-repeatable")); } /** @@ -347,7 +347,7 @@ public class TryToCompleteTest { challenge.setMaxTimes(0); when(cm.getChallengeTimes(any(), any(), any(Challenge.class))).thenReturn(0L); assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name"); + verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"), eq("name")); } /** @@ -357,7 +357,7 @@ public class TryToCompleteTest { public void testCompleteChallengesAddonUserChallengeWorldStringStringNoRank() { when(island.isAllowed(any(), any())).thenReturn(false); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.errors.no-rank"); + verify(user).getTranslation(any(World.class), eq("challenges.messages.no-rank")); } /** @@ -366,7 +366,7 @@ public class TryToCompleteTest { @Test public void testCompleteChallengesAddonUserChallengeWorldStringStringIntZero() { assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix, 0)); - verify(user).getTranslation("challenges.errors.not-valid-integer"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.not-valid-integer")); } /** @@ -375,7 +375,7 @@ public class TryToCompleteTest { @Test public void testCompleteChallengesAddonUserChallengeWorldStringStringIntNegative() { assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix, -10)); - verify(user).getTranslation("challenges.errors.not-valid-integer"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.not-valid-integer")); } /** @@ -385,7 +385,7 @@ public class TryToCompleteTest { public void testCompleteChallengesAddonUserChallengeWorldStringStringIntPositiveWrongEnvinonment() { challenge.setEnvironment(Collections.singleton(Environment.NETHER)); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix, 100)); - verify(user).getTranslation("challenges.errors.wrong-environment"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.wrong-environment")); } /** @@ -398,7 +398,7 @@ public class TryToCompleteTest { when(user.hasPermission(anyString())).thenReturn(false); challenge.setRequirements(req); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix, 100)); - verify(user).getTranslation("general.errors.no-permission"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.no-permission")); } /** @@ -407,7 +407,7 @@ public class TryToCompleteTest { @Test public void testCompleteChallengesAddonUserChallengeWorldStringStringSuccess() { assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name"); + verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"), eq("name")); } /** @@ -419,7 +419,7 @@ public class TryToCompleteTest { req.setRequiredItems(Collections.singletonList(new ItemStack(Material.EMERALD_BLOCK))); challenge.setRequirements(req); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.errors.not-enough-items", "[items]", "challenges.materials.emerald_block"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.not-enough-items"), eq("[items]"), eq("challenges.materials.emerald_block")); } /** @@ -454,9 +454,9 @@ public class TryToCompleteTest { assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); // Sufficient emerald blocks - verify(user, never()).getTranslation("challenges.errors.not-enough-items", "[items]", "challenges.materials.emerald_block"); + verify(user, never()).getTranslation(any(World.class), eq("challenges.errors.not-enough-items"), eq("[items]"), eq("challenges.materials.emerald_block")); // Not enough books - verify(user).getTranslation("challenges.errors.not-enough-items", "[items]", "challenges.materials.enchanted_book"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.not-enough-items"), eq("[items]"),eq("challenges.materials.enchanted_book")); } /** @@ -466,7 +466,7 @@ public class TryToCompleteTest { public void testCompleteChallengesAddonUserChallengeWorldStringStringSuccessCreative() { when(player.getGameMode()).thenReturn(GameMode.CREATIVE); assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name"); + verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"),eq("name")); } /** @@ -496,7 +496,7 @@ public class TryToCompleteTest { req.setSearchRadius(1); challenge.setRequirements(req); assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name"); + verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"), eq("name")); } @@ -512,7 +512,7 @@ public class TryToCompleteTest { req.setSearchRadius(1); challenge.setRequirements(req); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "3", "[item]", "challenges.entities.ghast.name"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("3"), eq("[item]"), eq("challenges.entities.ghast.name")); } @@ -531,9 +531,9 @@ public class TryToCompleteTest { req.setSearchRadius(1); challenge.setRequirements(req); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "3", "[item]", "challenges.entities.ghast.name"); - verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "1", "[item]", "challenges.entities.pufferfish.name"); - verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "5", "[item]", "challenges.entities.chicken.name"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("3"), eq("[item]"), eq("challenges.entities.ghast.name")); + verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("1"), eq("[item]"), eq("challenges.entities.pufferfish.name")); + verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("5"), eq("[item]"), eq("challenges.entities.chicken.name")); } @@ -558,9 +558,9 @@ public class TryToCompleteTest { List list = Collections.singletonList(ent); when(world.getNearbyEntities(any(BoundingBox.class))).thenReturn(list); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "3", "[item]", "challenges.entities.ghast.name"); - verify(user, never()).getTranslation("challenges.errors.you-still-need", "[amount]", "1", "[item]", "challenges.entities.pufferfish.name"); - verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "5", "[item]", "challenges.entities.chicken.name"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("3"), eq("[item]"), eq("challenges.entities.ghast.name")); + verify(user, never()).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("1"), eq("[item]"), eq("challenges.entities.pufferfish.name")); + verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("5"), eq("[item]"), eq("challenges.entities.chicken.name")); } @@ -583,7 +583,7 @@ public class TryToCompleteTest { List list = Collections.singletonList(ent); when(world.getNearbyEntities(any(BoundingBox.class))).thenReturn(list); assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.messages.you-completed-challenge", "[value]", "name"); + verify(user).getTranslation(any(World.class), eq("challenges.messages.you-completed-challenge"), eq("[value]"), eq("name")); } /** @@ -611,7 +611,7 @@ public class TryToCompleteTest { when(world.getNearbyEntities(any(BoundingBox.class))).thenReturn(list); when(netherWorld.getNearbyEntities(any(BoundingBox.class))).thenReturn(Collections.emptyList()); assertFalse(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix)); - verify(user).getTranslation("challenges.errors.you-still-need", "[amount]", "1", "[item]", "challenges.entities.pufferfish.name"); + verify(user).getTranslation(any(World.class), eq("challenges.errors.you-still-need"), eq("[amount]"), eq("1"), eq("[item]"), eq("challenges.entities.pufferfish.name")); } /** @@ -621,7 +621,7 @@ public class TryToCompleteTest { public void testCompleteChallengesAddonUserChallengeWorldStringStringIntMultipleTimesPositiveSuccess() { // Try to complete 10 times. Already done 3 times, and max is 10, so it should be only done 7 times assertTrue(TryToComplete.complete(addon, user, challenge, world, topLabel, permissionPrefix, 10)); - verify(user).getTranslation("challenges.messages.you-repeated-challenge-multiple", "[value]", "name", "[count]", "7"); + verify(user).getTranslation(any(World.class), eq("challenges.messages.you-repeated-challenge-multiple"), eq("[value]"), eq("name"), eq("[count]"), eq("7")); } /** From 82ba14403815c74eb13a170b529d70fa30e1347f Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 4 Jun 2023 10:38:45 -0700 Subject: [PATCH 2/6] Fixed CompleteChallengeCommandTest --- .../commands/CompleteChallengeCommandTest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/java/world/bentobox/challenges/commands/CompleteChallengeCommandTest.java b/src/test/java/world/bentobox/challenges/commands/CompleteChallengeCommandTest.java index 5b9e4f4..3c3cb01 100644 --- a/src/test/java/world/bentobox/challenges/commands/CompleteChallengeCommandTest.java +++ b/src/test/java/world/bentobox/challenges/commands/CompleteChallengeCommandTest.java @@ -51,6 +51,7 @@ import world.bentobox.challenges.config.Settings; import world.bentobox.challenges.config.SettingsUtils.VisibilityMode; import world.bentobox.challenges.database.object.Challenge; import world.bentobox.challenges.tasks.TryToComplete; +import world.bentobox.challenges.utils.Constants; import world.bentobox.challenges.utils.Utils; /** @@ -207,7 +208,8 @@ public class CompleteChallengeCommandTest { @Test public void testExecuteUserStringListOfStringNoArgs() { assertFalse(cc.execute(user, "complete", Collections.emptyList())); - verify(user).getTranslation(eq("challenges.errors.no-name")); + PowerMockito.verifyStatic(Utils.class); + Utils.sendMessage(user, world, Constants.ERRORS + "no-name"); verify(user).sendMessage(eq("commands.help.header"), eq(TextVariables.LABEL), eq("BSkyBlock")); } @@ -218,7 +220,8 @@ public class CompleteChallengeCommandTest { public void testExecuteUserStringListOfStringUnknownChallenge() { when(chm.getChallenge(anyString())).thenReturn(null); assertFalse(cc.execute(user, "complete", Collections.singletonList("mychal"))); - verify(user).getTranslation(eq("challenges.errors.unknown-challenge")); + PowerMockito.verifyStatic(Utils.class); + Utils.sendMessage(user, world, Constants.ERRORS + "unknown-challenge"); verify(user).sendMessage(eq("commands.help.header"), eq(TextVariables.LABEL), eq("BSkyBlock")); } @@ -247,7 +250,8 @@ public class CompleteChallengeCommandTest { @Test public void testExecuteUserStringListOfStringKnownChallengeSuccessMultipleTimesNoPerm() { assertTrue(cc.execute(user, "complete", Arrays.asList("mychal", "5"))); - verify(user).getTranslation(eq("challenges.error.no-multiple-permission")); + PowerMockito.verifyStatic(Utils.class); + Utils.sendMessage(user, world, Constants.ERRORS + "no-multiple-permission"); } /** From ddebdf0e6235da08a64fda8c86e8ed8d54067191 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 4 Jun 2023 10:41:18 -0700 Subject: [PATCH 3/6] Fixed ChallengesCommandTest --- .../commands/ChallengesCommandTest.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/test/java/world/bentobox/challenges/commands/ChallengesCommandTest.java b/src/test/java/world/bentobox/challenges/commands/ChallengesCommandTest.java index 5d12e2a..14df58a 100644 --- a/src/test/java/world/bentobox/challenges/commands/ChallengesCommandTest.java +++ b/src/test/java/world/bentobox/challenges/commands/ChallengesCommandTest.java @@ -104,7 +104,7 @@ public class ChallengesCommandTest { Optional optionalAddon = Optional.of(gameModeAddon); when(iwm.getAddon(any())).thenReturn(optionalAddon); when(plugin.getIWM()).thenReturn(iwm); - + @NonNull WorldSettings ws = new TestWorldSetting(); when(iwm.getWorldSettings(any())).thenReturn(ws); @@ -172,7 +172,7 @@ public class ChallengesCommandTest { public void testCanExecuteWrongWorld() { when(iwm.inWorld(any(World.class))).thenReturn(false); assertFalse(cc.canExecute(user, "challenges", Collections.emptyList())); - verify(user).getTranslation("general.errors.wrong-world"); + verify(user).getTranslation(world, "general.errors.wrong-world"); } /** @@ -184,7 +184,7 @@ public class ChallengesCommandTest { when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false); assertFalse(cc.canExecute(user, "challenges", Collections.emptyList())); verify(addon).logError("There are no challenges set up in world!"); - verify(user).getTranslation("challenges.errors.no-challenges"); + verify(user).getTranslation(world, "challenges.errors.no-challenges"); } /** @@ -196,8 +196,8 @@ public class ChallengesCommandTest { when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false); assertFalse(cc.canExecute(user, "challenges", Collections.emptyList())); verify(addon).logError("There are no challenges set up in world!"); - verify(user).getTranslation("challenges.errors.no-challenges-admin", "[command]", "bsb challenges"); - verify(user, never()).getTranslation("challenges.errors.no-challenges"); + verify(user).getTranslation(world, "challenges.errors.no-challenges-admin", "[command]", "bsb challenges"); + verify(user, never()).getTranslation(world, "challenges.errors.no-challenges"); } /** @@ -209,8 +209,8 @@ public class ChallengesCommandTest { when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false); assertFalse(cc.canExecute(user, "challenges", Collections.emptyList())); verify(addon).logError("There are no challenges set up in world!"); - verify(user).getTranslation("challenges.errors.no-challenges-admin", "[command]", "bsb challenges"); - verify(user, never()).getTranslation("challenges.errors.no-challenges"); + verify(user).getTranslation(world, "challenges.errors.no-challenges-admin", "[command]", "bsb challenges"); + verify(user, never()).getTranslation(world, "challenges.errors.no-challenges"); } /** @@ -223,8 +223,8 @@ public class ChallengesCommandTest { when(chm.hasAnyChallengeData(any(World.class))).thenReturn(false); assertFalse(cc.canExecute(user, "challenges", Collections.emptyList())); verify(addon).logError("There are no challenges set up in world!"); - verify(user).getTranslation("challenges.errors.no-challenges-admin", "[command]", "bsb challenges"); - verify(user, never()).getTranslation("challenges.errors.no-challenges"); + verify(user).getTranslation(world, "challenges.errors.no-challenges-admin", "[command]", "bsb challenges"); + verify(user, never()).getTranslation(world, "challenges.errors.no-challenges"); } /** @@ -234,7 +234,7 @@ public class ChallengesCommandTest { public void testCanExecuteNoIsland() { when(im.getIsland(any(), any(User.class))).thenReturn(null); assertFalse(cc.canExecute(user, "challenges", Collections.emptyList())); - verify(user).getTranslation("general.errors.no-island"); + verify(user).getTranslation(world, "general.errors.no-island"); } /** From 480ffd8eb456b6243dfb396718d3bf47f3dc5cd6 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 4 Jun 2023 10:49:16 -0700 Subject: [PATCH 4/6] Fixed ChallengesManagerTest --- .../challenges/ChallengesManagerTest.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/test/java/world/bentobox/challenges/ChallengesManagerTest.java b/src/test/java/world/bentobox/challenges/ChallengesManagerTest.java index 4e8fca2..c690e34 100644 --- a/src/test/java/world/bentobox/challenges/ChallengesManagerTest.java +++ b/src/test/java/world/bentobox/challenges/ChallengesManagerTest.java @@ -82,7 +82,7 @@ public class ChallengesManagerTest { // Mocks @Mock private ChallengesAddon addon; - @Mock + private Settings settings; @Mock private IslandWorldManager iwm; @@ -134,9 +134,11 @@ public class ChallengesManagerTest { when(s.getDatabaseType()).thenReturn(DatabaseType.JSON); // Addon Settings + settings = new Settings(); when(addon.getChallengesSettings()).thenReturn(settings); - when(settings.isStoreHistory()).thenReturn(true); - when(settings.getLifeSpan()).thenReturn(10); + settings.setStoreAsIslandData(false); + settings.setStoreHistory(true); + settings.setLifeSpan(10); // Database database = new File("database"); @@ -264,7 +266,7 @@ public class ChallengesManagerTest { assertTrue(cm.loadChallenge(challenge, world, false, user, true)); // load twice - no overwrite, not silent assertFalse(cm.loadChallenge(challenge, world, false, user, false)); - verify(user).getTranslation("challenges.messages.load-skipping", "[value]", "name"); + verify(user).getTranslation(world, "challenges.messages.load-skipping", "[value]", "name"); } /** @@ -276,7 +278,7 @@ public class ChallengesManagerTest { assertTrue(cm.loadChallenge(challenge, world, false, user, true)); // overwrite assertTrue(cm.loadChallenge(challenge, world, true, user, true)); - verify(user, never()).getTranslation(anyString(), anyString(), anyString()); + verify(user, never()).getTranslation(any(World.class), anyString(), anyString(), anyString()); } /** @@ -288,7 +290,7 @@ public class ChallengesManagerTest { assertTrue(cm.loadChallenge(challenge, world, false, user, true)); // overwrite not silent assertTrue(cm.loadChallenge(challenge, world, true, user, false)); - verify(user).getTranslation("challenges.messages.load-overwriting", "[value]", "name"); + verify(user).getTranslation(world, "challenges.messages.load-overwriting", "[value]", "name"); } /** @@ -311,7 +313,7 @@ public class ChallengesManagerTest { assertTrue(cm.loadLevel(level, world, false, user, true)); // load twice - no overwrite, not silent assertFalse(cm.loadLevel(level, world, false, user, false)); - verify(user).getTranslation("challenges.messages.load-skipping", "[value]", "Novice"); + verify(user).getTranslation(world, "challenges.messages.load-skipping", "[value]", "Novice"); } /** @@ -323,7 +325,7 @@ public class ChallengesManagerTest { assertTrue(cm.loadLevel(level, world, false, user, true)); // overwrite assertTrue(cm.loadLevel(level, world, true, user, true)); - verify(user, never()).getTranslation(anyString(), anyString(), anyString()); + verify(user, never()).getTranslation(any(World.class), anyString(), anyString(), anyString()); } /** @@ -335,7 +337,7 @@ public class ChallengesManagerTest { assertTrue(cm.loadLevel(level, world, false, user, true)); // overwrite not silent assertTrue(cm.loadLevel(level, world, true, user, false)); - verify(user).getTranslation("challenges.messages.load-overwriting", "[value]", "Novice"); + verify(user).getTranslation(world, "challenges.messages.load-overwriting", "[value]", "Novice"); } /** From 9da197de21dd07bff67155b68a9203302afbd30d Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 24 Jun 2023 13:02:26 -0700 Subject: [PATCH 5/6] Update Github Action build script --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b8156b..365bfca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,21 +11,21 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Set up JDK 17 - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: java-version: 17 - name: Cache SonarCloud packages - uses: actions/cache@v1 + uses: actions/cache@v3 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - name: Cache Maven packages - uses: actions/cache@v1 + uses: actions/cache@v3 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} From 125a3249ac362298ca1aef2c82a8240badaf1b56 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 24 Jun 2023 13:52:45 -0700 Subject: [PATCH 6/6] Add required distribution --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 365bfca..9296f26 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,7 @@ jobs: - name: Set up JDK 17 uses: actions/setup-java@v3 with: + distribution: 'adopt' java-version: 17 - name: Cache SonarCloud packages uses: actions/cache@v3