### Question:
HelpProvider implements Reloadable { @VisibleForTesting static List<String> filterCorrectLabels(CommandDescription command, List<String> labels) { List<CommandDescription> commands = CommandUtils.constructParentList(command); List<String> correctLabels = new ArrayList<>(); boolean foundIncorrectLabel = false; for (int i = 0; i < commands.size(); ++i) { if (!foundIncorrectLabel && i < labels.size() && commands.get(i).hasLabel(labels.get(i))) { correctLabels.add(labels.get(i)); } else { foundIncorrectLabel = true; correctLabels.add(commands.get(i).getLabels().get(0)); } } return correctLabels; } @Inject  HelpProvider(PermissionsManager permissionsManager, HelpMessagesService helpMessagesService); void outputHelp(CommandSender sender, FoundCommandResult result, int options); @Override void reload(); static final int SHOW_COMMAND; static final int SHOW_DESCRIPTION; static final int SHOW_LONG_DESCRIPTION; static final int SHOW_ARGUMENTS; static final int SHOW_PERMISSIONS; static final int SHOW_ALTERNATIVES; static final int SHOW_CHILDREN; static final int ALL_OPTIONS; }### Answer:
@Test public void shouldRetainCorrectLabels() { List<String> labels = Arrays.asList("authme", "reg"); CommandDescription command = getCommandWithLabel(commands, "authme", "register"); List<String> result = HelpProvider.filterCorrectLabels(command, labels); assertThat(result, equalTo(labels)); }
@Test public void shouldReplaceIncorrectLabels() { List<String> labels = Arrays.asList("authme", "wrong"); CommandDescription command = getCommandWithLabel(commands, "authme", "register"); List<String> result = HelpProvider.filterCorrectLabels(command, labels); assertThat(result, contains("authme", "register")); }