You changed the behavior by changing the error message. It would now be something like this:
``` Error parsing arguments '[--a, -b, --]' on '--'. Keys should never be empty" ``` However, previously the message would have been: ``` The input [--a, -b, --] contains an empty argument ``` The message `Error parsing arguments '[--a, -b, --]' on '--'.` does not add any information. I would revert to the old message. Then you also do not need the extra variable `errorMessage`. I would also rewrite the tests `testEmptyVal` and `testEmptyValShort` in the following way: ``` @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", "-"}); } ``` This way we assert that the exception message is correct. [ Full content available at: https://github.com/apache/flink/pull/6737 ] This message was relayed via gitbox.apache.org for devnull@infra.apache.org