Fixed tests in DefaultHelpCommandTest

This commit is contained in:
Florian CUNY 2018-08-11 14:39:12 +02:00
parent d58570330a
commit 9c240fbf54

View File

@ -133,15 +133,13 @@ public class DefaultHelpCommandTest {
when(parent.getDescription()).thenReturn("description"); when(parent.getDescription()).thenReturn("description");
when(parent.getPermission()).thenReturn("permission"); when(parent.getPermission()).thenReturn("permission");
when(parent.getWorld()).thenReturn(mock(World.class)); when(parent.getWorld()).thenReturn(mock(World.class));
when(user.getTranslationOrNothing("island")).thenReturn("island");
when(user.getTranslationOrNothing("parameters")).thenReturn(""); when(user.getTranslationOrNothing("parameters")).thenReturn("");
when(user.getTranslationOrNothing("description")).thenReturn("the main island command"); when(user.getTranslation("description")).thenReturn("the main island command");
DefaultHelpCommand dhc = new DefaultHelpCommand(parent); DefaultHelpCommand dhc = new DefaultHelpCommand(parent);
dhc.execute(user, dhc.getLabel(), new ArrayList<>()); dhc.execute(user, dhc.getLabel(), new ArrayList<>());
Mockito.verify(user).sendMessage("commands.help.header", "[label]", "BSkyBlock"); Mockito.verify(user).sendMessage("commands.help.header", "[label]", "BSkyBlock");
Mockito.verify(user).getTranslationOrNothing("island");
Mockito.verify(user).getTranslationOrNothing("parameters"); Mockito.verify(user).getTranslationOrNothing("parameters");
Mockito.verify(user).getTranslationOrNothing("description"); Mockito.verify(user).getTranslation("description");
Mockito.verify(user).sendMessage( Mockito.verify(user).sendMessage(
"commands.help.syntax", "commands.help.syntax",
"[usage]", "[usage]",
@ -162,17 +160,15 @@ public class DefaultHelpCommandTest {
when(parent.getParameters()).thenReturn("parameters"); when(parent.getParameters()).thenReturn("parameters");
when(parent.getDescription()).thenReturn("description"); when(parent.getDescription()).thenReturn("description");
when(parent.getPermission()).thenReturn("permission"); when(parent.getPermission()).thenReturn("permission");
when(user.getTranslationOrNothing("island")).thenReturn("island");
when(user.getTranslationOrNothing("parameters")).thenReturn(""); when(user.getTranslationOrNothing("parameters")).thenReturn("");
when(user.getTranslationOrNothing("description")).thenReturn("the main island command"); when(user.getTranslation("description")).thenReturn("the main island command");
DefaultHelpCommand dhc = new DefaultHelpCommand(parent); DefaultHelpCommand dhc = new DefaultHelpCommand(parent);
List<String> args = new ArrayList<>(); List<String> args = new ArrayList<>();
args.add("1"); args.add("1");
dhc.execute(user, dhc.getLabel(), args); dhc.execute(user, dhc.getLabel(), args);
// There are no header or footer shown // There are no header or footer shown
Mockito.verify(user).getTranslationOrNothing("island");
Mockito.verify(user).getTranslationOrNothing("parameters"); Mockito.verify(user).getTranslationOrNothing("parameters");
Mockito.verify(user).getTranslationOrNothing("description"); Mockito.verify(user).getTranslation("description");
Mockito.verify(user).sendMessage( Mockito.verify(user).sendMessage(
"commands.help.syntax", "commands.help.syntax",
"[usage]", "[usage]",