flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From greghogan <...@git.apache.org>
Subject [GitHub] flink pull request #4169: [FLINK-6357] [java] ParameterTool get unrequested ...
Date Mon, 10 Jul 2017 15:12:00 GMT
Github user greghogan commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4169#discussion_r126450338
  
    --- Diff: flink-java/src/test/java/org/apache/flink/api/java/utils/ParameterToolTest.java
---
    @@ -174,9 +210,38 @@ public void testUnrequestedByte() {
     
     		// test repeated access
     		Assert.assertEquals(1, parameter.getByte("byte"));
    +		Assert.assertEquals(Collections.emptySet(), parameter.getUnrequestedParameters());
    +	}
    +
    +	@Test
    +	public void testUnrequestedByteWithDefaultValue() {
    +		ParameterTool parameter = ParameterTool.fromArgs(new String[]{"-byte", "1"});
    +		Assert.assertEquals(Sets.newHashSet("byte"), parameter.getUnrequestedParameters());
    +
    +		// test parameter access
    +		Assert.assertEquals(1, parameter.getByte("byte", (byte) 0));
    +		Assert.assertEquals(Collections.emptySet(), parameter.getUnrequestedParameters());
    +
    +		// test repeated access
    +		Assert.assertEquals(1, parameter.getByte("byte", (byte) 0));
    +		Assert.assertEquals(Collections.emptySet(), parameter.getUnrequestedParameters());
     	}
     
     	@Test
    +	public void testUnrequestedByteWithMissingValue() {
    +		ParameterTool parameter = ParameterTool.fromArgs(new String[]{"-byte"});
    +		Assert.assertEquals(Sets.newHashSet("byte"), parameter.getUnrequestedParameters());
    +
    +		exception.expect(RuntimeException.class);
    +		exception.expectMessage("For input string: \"__NO_VALUE_KEY\"");
    +
    +		parameter.getByte("byte");
    +		Assert.assertEquals(Collections.emptySet(), parameter.getUnrequestedParameters());
    --- End diff --
    
    No, the expected exception is checked and does not terminate the test.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message