[(master)] Fixed faulty test

This commit is contained in:
Simon Marco Janic 2017-11-06 13:38:25 +01:00
parent ee3d540607
commit f0477ac807
2 changed files with 18 additions and 22 deletions

View File

@ -721,7 +721,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
}
writeMetadataExtensions(extensionKeys, "extension", theEventWriter);
writeMetadataExtensions(extensionKeys, "modifierExtension", theEventWriter);
writeMetadataExtensions(modifierExtensionKeys, "modifierExtension", theEventWriter);
}
private void writeMetadataExtensions(List<Map.Entry<ResourceMetadataKeyEnum<?>, Object>> extensions, String arrayName, JsonLikeWriter theEventWriter) throws IOException {

View File

@ -1719,29 +1719,25 @@ public class JsonParserDstu2Test {
addExtensionResourceMetadataKeyToResource(procedureRequest, true, "http://someurl.com/modifier", "SomeValue");
addExtensionResourceMetadataKeyToResource(procedureRequest, true, "http://someurl.com/modifier2", "SomeValue2");
String json = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(procedureRequest);
String json = ourCtx.newJsonParser().encodeResourceToString(procedureRequest);
// @formatter:off
assertThat(json, stringContainsInOrder("\"meta\": {",
"\"extension\": [", "{",
"\"url\": \"http://someurl.com\",",
"\"valueString\": \"SomeValue\"",
"},",
"{",
"\"url\": \"http://someurl2.com\",",
"\"valueString\": \"SomeValue2\"",
"}",
"],",
"\"modifierExtension\": [",
"{",
"\"url\": \"http://someurl.com\",",
"\"valueString\": \"SomeValue\"",
"},",
"{",
"\"url\": \"http://someurl2.com\",",
"\"valueString\": \"SomeValue2\"",
"}",
"]"));
assertThat(json, stringContainsInOrder(
"\"meta\":{",
"\"extension\":[{",
"\"url\":\"http://someurl.com\",",
"\"valueString\":\"SomeValue\"",
"},{",
"\"url\":\"http://someurl2.com\",",
"\"valueString\":\"SomeValue2\"",
"}],",
"\"modifierExtension\":[{",
"\"url\":\"http://someurl.com/modifier\",",
"\"valueString\":\"SomeValue\"",
"},{",
"\"url\":\"http://someurl.com/modifier2\",",
"\"valueString\":\"SomeValue2\"",
"}]"));
// @formatter:on
}