MaterialType implements WordType<Material> { @Override public Material parse(StringReader reader) throws CommandSyntaxException { var name = reader.readUnquotedString().toLowerCase(); var material = MATERIALS.get(name); if (material == null) { throw EXCEPTION.createWithContext(reader, name); } return material; }  @Override Material parse(StringReader reader); @Override CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder); @Override List<String> getExamples();  }
@Test void parse() throws CommandSyntaxException { assertEquals(Material.CACTUS, type.parse(new StringReader("CACTUS"))); }
@Test void parse_throws_exception() throws CommandSyntaxException { assertEquals( "Unknown material: invalid", assertThrows(CommandSyntaxException.class, () -> type.parse(new StringReader("invalid"))).getRawMessage().toString() ); }