public DrawCommand buildCommand(final String input) { String trimmedInput = input.trim(); if (trimmedInput.isEmpty()) { throw new IllegalArgumentException("A command must be provided"); } String command = trimmedInput.split(" ")[0].toUpperCase(); CommandBuilder commandBuilder = drawOptions.get(command); if (commandBuilder == null) { throw new IllegalArgumentException("The command '" + command + "' is not supported"); } return commandBuilder.create(trimmedInput); }