WorldType implements StringType<World> { @Override public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) { for (var world : Bukkit.getWorlds()) { if (world.getName().startsWith(builder.getRemaining())) { builder.suggest(world.getName().contains(" ") ? '"' + world.getName() + '"' : world.getName()); } } return builder.buildFuture(); }  @Override World parse(StringReader reader); @Override CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder); @Override List<String> getExamples();  }
@Test void listSuggestions() { SuggestionsBuilder builder = when(mock(SuggestionsBuilder.class).getRemaining()).thenReturn("worl").getMock(); type.listSuggestions(null, builder); verify(builder).suggest("\"world name\""); verify(builder).suggest("world_name"); }