Fix String formatted Exception message logging the Environment state in from(:Environment).

This commit is contained in:
John Blum
2018-05-28 15:44:18 -07:00
parent 12a11de856
commit d0013ffce5
2 changed files with 6 additions and 8 deletions

View File

@@ -98,8 +98,8 @@ public class VcapPropertySource extends PropertySource<EnumerablePropertySource<
.map(propertySources -> propertySources.get(VCAP_PROPERTY_SOURCE_NAME))
.map(VcapPropertySource::from)
.orElseThrow(() -> newIllegalArgumentException(
"Environment [%1$s] was not configurable or does not contain an enumerable [%2$s] PropertySource",
environment, VCAP_PROPERTY_SOURCE_NAME));
"Environment was not configurable or does not contain an enumerable [%s] PropertySource",
VCAP_PROPERTY_SOURCE_NAME));
}
public static VcapPropertySource from(Properties properties) {

View File

@@ -89,9 +89,8 @@ public class VcapPropertySourceUnitTests {
}
catch (IllegalArgumentException expected) {
assertThat(expected).hasMessage(
"Environment [%s] was not configurable or does not contain an enumerable [vcap] PropertySource",
mockEnvironment);
assertThat(expected)
.hasMessage("Environment was not configurable or does not contain an enumerable [vcap] PropertySource");
assertThat(expected).hasNoCause();
@@ -117,9 +116,8 @@ public class VcapPropertySourceUnitTests {
}
catch (IllegalArgumentException expected) {
assertThat(expected).hasMessage(
"Environment [%s] was not configurable or does not contain an enumerable [vcap] PropertySource",
mockEnvironment);
assertThat(expected)
.hasMessage("Environment was not configurable or does not contain an enumerable [vcap] PropertySource");
assertThat(expected).hasNoCause();