### Question:
CommandManager implements Reloadable { public void runCommandsOnLogin(Player player, List<String> otherAccounts) { final int numberOfOtherAccounts = otherAccounts.size(); executeCommands(player, onLoginCommands.getAdaptedItems(player), cmd -> shouldCommandBeRun(cmd, numberOfOtherAccounts)); } @Inject  CommandManager(@DataFolder File dataFolder, BukkitService bukkitService, GeoIpService geoIpService,
                   CommandMigrationService commandMigrationService); void runCommandsOnJoin(Player player); void runCommandsOnRegister(Player player); void runCommandsOnLogin(Player player, List<String> otherAccounts); void runCommandsOnSessionLogin(Player player); void runCommandsOnFirstLogin(Player player, List<String> otherAccounts); void runCommandsOnUnregister(Player player); void runCommandsOnLogout(Player player); @Override void reload();  }### Answer:
@Test public void shouldExecuteCommandsOnLogin() { copyJarFileAsCommandsYml(TEST_FILES_FOLDER + "commands.complete.yml"); initManager(); manager.runCommandsOnLogin(player, Collections.emptyList()); verify(bukkitService).dispatchConsoleCommand("msg Bobby Welcome back"); verify(bukkitService).dispatchCommand(any(Player.class), eq("motd")); verify(bukkitService).dispatchCommand(any(Player.class), eq("list")); verifyNoMoreInteractions(bukkitService); verifyZeroInteractions(geoIpService); }
@Test public void shouldExecuteCommandsOnLoginWithTwoAlts() { copyJarFileAsCommandsYml(TEST_FILES_FOLDER + "commands.complete.yml"); initManager(); manager.runCommandsOnLogin(player, Arrays.asList("willy", "nilly", "billy", "silly")); verify(bukkitService).dispatchConsoleCommand("msg Bobby Welcome back"); verify(bukkitService).dispatchCommand(player, "motd"); verify(bukkitService).dispatchCommand(player, "list"); verify(bukkitService).dispatchConsoleCommand("helpop Player Bobby has more than 1 account"); verifyNoMoreInteractions(bukkitService); verifyZeroInteractions(geoIpService); }
@Test public void shouldExecuteCommandsOnLoginWithFifteenAlts() { copyJarFileAsCommandsYml(TEST_FILES_FOLDER + "commands.complete.yml"); initManager(); manager.runCommandsOnLogin(player, Collections.nCopies(15, "swag")); verify(bukkitService).dispatchConsoleCommand("msg Bobby Welcome back"); verify(bukkitService).dispatchCommand(player, "motd"); verify(bukkitService).dispatchCommand(player, "list"); verify(bukkitService).dispatchConsoleCommand("helpop Player Bobby has more than 1 account"); verify(bukkitService).dispatchConsoleCommand("log Bobby 127.0.0.3 many accounts"); verifyNoMoreInteractions(bukkitService); verifyZeroInteractions(geoIpService); }
@Test public void shouldExecuteCommandsOnLoginWithTwentyFiveAlts() { copyJarFileAsCommandsYml(TEST_FILES_FOLDER + "commands.complete.yml"); initManager(); manager.runCommandsOnLogin(player, Collections.nCopies(25, "yolo")); verify(bukkitService).dispatchConsoleCommand("msg Bobby Welcome back"); verify(bukkitService).dispatchCommand(player, "motd"); verify(bukkitService).dispatchCommand(player, "list"); verify(bukkitService).dispatchConsoleCommand("helpop Player Bobby has more than 1 account"); verifyNoMoreInteractions(bukkitService); verifyZeroInteractions(geoIpService); }
@Test public void shouldExecuteCommandsOnLoginWithIncompleteConfig() { copyJarFileAsCommandsYml(TEST_FILES_FOLDER + "commands.incomplete.yml"); initManager(); manager.runCommandsOnLogin(player, Collections.emptyList()); verify(bukkitService).dispatchConsoleCommand("msg Bobby Welcome back, bob"); verify(bukkitService).dispatchCommand(any(Player.class), eq("list")); verifyNoMoreInteractions(bukkitService); verifyZeroInteractions(geoIpService); }