EnchantmentType implements WordType<Enchantment> { @Override public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) { for (var enchantment : ENCHANTMENTS.prefixedKeys(builder.getRemaining())) { builder.suggest(enchantment); } return builder.buildFuture(); }  @Override Enchantment parse(StringReader reader); @Override CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder); @Override List<String> getExamples();  }
@Test void listSuggestions() { EnchantmentType.ENCHANTMENTS.put("arrow_damage", mock(Enchantment.class)); EnchantmentType.ENCHANTMENTS.put("arrow_fire", mock(Enchantment.class)); SuggestionsBuilder builder = when(mock(SuggestionsBuilder.class).getRemaining()).thenReturn("arro").getMock(); type.listSuggestions(null, builder); verify(builder).suggest("arrow_damage"); verify(builder).suggest("arrow_fire"); }