### Question:
ParameterTool extends ExecutionConfig.GlobalJobParameters implements Serializable, Cloneable { public static ParameterTool fromArgs(String[] args) { final Map<String, String> map = new HashMap<>(args.length / 2); int i = 0; while (i < args.length) { final String key; if (args[i].startsWith("--")) { key = args[i].substring(2); } else if (args[i].startsWith("-")) { key = args[i].substring(1); } else { throw new IllegalArgumentException( String.format("Error parsing arguments '%s' on '%s'. Please prefix keys with -- or -.", Arrays.toString(args), args[i])); } if (key.isEmpty()) { throw new IllegalArgumentException( "The input " + Arrays.toString(args) + " contains an empty argument"); } i += 1; if (i >= args.length) { map.put(key, NO_VALUE_KEY); } else if (NumberUtils.isNumber(args[i])) { map.put(key, args[i]); i += 1; } else if (args[i].startsWith("--") || args[i].startsWith("-")) { map.put(key, NO_VALUE_KEY); } else { map.put(key, args[i]); i += 1; } } return fromMap(map); } private  ParameterTool(Map<String, String> data); static ParameterTool fromArgs(String[] args); static ParameterTool fromPropertiesFile(String path); static ParameterTool fromPropertiesFile(File file); static ParameterTool fromPropertiesFile(InputStream inputStream); static ParameterTool fromMap(Map<String, String> map); static ParameterTool fromSystemProperties(); @Override boolean equals(Object o); @Override int hashCode(); @PublicEvolving Set<String> getUnrequestedParameters(); int getNumberOfParameters(); String get(String key); String getRequired(String key); String get(String key, String defaultValue); boolean has(String value); int getInt(String key); int getInt(String key, int defaultValue); long getLong(String key); long getLong(String key, long defaultValue); float getFloat(String key); float getFloat(String key, float defaultValue); double getDouble(String key); double getDouble(String key, double defaultValue); boolean getBoolean(String key); boolean getBoolean(String key, boolean defaultValue); short getShort(String key); short getShort(String key, short defaultValue); byte getByte(String key); byte getByte(String key, byte defaultValue); Configuration getConfiguration(); Properties getProperties(); void createPropertiesFile(String pathToFile); void createPropertiesFile(String pathToFile, boolean overwrite); ParameterTool mergeWith(ParameterTool other); @Override Map<String, String> toMap();  }### Answer:
@Test public void testThrowExceptionIfParameterIsNotPrefixed() { exception.expect(IllegalArgumentException.class); exception.expectMessage("Error parsing arguments '[a]' on 'a'. Please prefix keys with -- or -."); ParameterTool.fromArgs(new String[]{"a"}); }
@Test public void testEmptyVal() { exception.expect(IllegalArgumentException.class); exception.expectMessage("The input [--a, -b, --] contains an empty argument"); ParameterTool.fromArgs(new String[]{"--a", "-b", "--"}); }
@Test public void testEmptyValShort() { exception.expect(IllegalArgumentException.class); exception.expectMessage("The input [--a, -b, -] contains an empty argument"); ParameterTool.fromArgs(new String[]{"--a", "-b", "-"}); }