@Test public void property_get_returns_value() { System.getProperties().put("ENV_GET_VAR", "ENV_GET_VALUE"); SystemFunctions.PropertyGet propertyGet = new SystemFunctions.PropertyGet(); String propertyVal = (String) propertyGet.apply(ImmutableList.of("ENV_GET_VAR")); assertThat("Value should match", propertyVal, equalTo("ENV_GET_VALUE")); }
@Test public void property_get_returns_null_if_key_is_not_string() { SystemFunctions.PropertyGet propertyGet = new SystemFunctions.PropertyGet(); String propertyVal = (String) propertyGet.apply(ImmutableList.of(new ArrayList())); assertThat("Value should be null", propertyVal, equalTo(null)); }
@Test public void property_get_nonexistent_returns_null() { SystemFunctions.PropertyGet propertyGet = new SystemFunctions.PropertyGet(); String propertyVal = (String) propertyGet.apply(ImmutableList.of("PROPERTY_MISSING")); assertThat("Value should not exist", propertyVal, equalTo(null)); }