Fixed errors and tests for CompleteChallengeCommandTest

This commit is contained in:
tastybento 2021-09-23 17:22:16 -07:00
parent 018455f8f6
commit c21cae91e1

View File

@ -83,7 +83,7 @@ public class CompleteChallengeCommandTest {
private IslandWorldManager iwm;
@Mock
private GameModeAddon gameModeAddon;
@Mock
private Settings settings;
@Mock
private Challenge challenge;
@ -159,8 +159,9 @@ public class CompleteChallengeCommandTest {
when(ChatColor.translateAlternateColorCodes(any(char.class), anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(1, String.class));
// Settings
settings = new Settings();
when(addon.getChallengesSettings()).thenReturn(settings);
when(settings.getVisibilityMode()).thenReturn(VisibilityMode.VISIBLE);
settings.setVisibilityMode(VisibilityMode.VISIBLE);
// Island
when(plugin.getIslands()).thenReturn(im);
@ -217,7 +218,7 @@ public class CompleteChallengeCommandTest {
@Test
public void testExecuteUserStringListOfStringNoArgs() {
assertFalse(cc.execute(user, "complete", Collections.emptyList()));
verify(user).sendMessage(eq("challenges.errors.no-name"));
verify(user).getTranslation(eq("challenges.errors.no-name"));
verify(user).sendMessage(eq("commands.help.header"), eq(TextVariables.LABEL), eq("BSkyBlock"));
}
@ -228,7 +229,7 @@ public class CompleteChallengeCommandTest {
public void testExecuteUserStringListOfStringUnknownChallenge() {
when(chm.getChallenge(anyString())).thenReturn(null);
assertFalse(cc.execute(user, "complete", Collections.singletonList("mychal")));
verify(user).sendMessage(eq("challenges.errors.unknown-challenge"));
verify(user).getTranslation(eq("challenges.errors.unknown-challenge"));
verify(user).sendMessage(eq("commands.help.header"), eq(TextVariables.LABEL), eq("BSkyBlock"));
}
@ -257,7 +258,7 @@ public class CompleteChallengeCommandTest {
@Test
public void testExecuteUserStringListOfStringKnownChallengeSuccessMultipleTimesNoPerm() {
assertTrue(cc.execute(user, "complete", Arrays.asList("mychal", "5")));
verify(user).sendMessage(eq("challenges.error.no-multiple-permission"));
verify(user).getTranslation(eq("challenges.error.no-multiple-permission"));
}
/**