Fix more unit tests for #378
This commit is contained in:
parent
035ed27dab
commit
255131164b
|
@ -70,7 +70,7 @@ public class AbstractJaxRsConformanceProviderDstu3Test {
|
||||||
Response response = createConformanceProvider(providers).conformance();
|
Response response = createConformanceProvider(providers).conformance();
|
||||||
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
|
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
|
||||||
assertTrue(response.getEntity().toString().contains("\"type\":\"Patient\""));
|
assertTrue(response.getEntity().toString().contains("\"type\":\"Patient\""));
|
||||||
assertTrue(response.getEntity().toString().contains("\"$someCustomOperation"));
|
assertTrue(response.getEntity().toString().contains("\"someCustomOperation"));
|
||||||
System.out.println(response);
|
System.out.println(response);
|
||||||
System.out.println(response.getEntity());
|
System.out.println(response.getEntity());
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public class AbstractJaxRsConformanceProviderDstu3Test {
|
||||||
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
|
assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus());
|
||||||
System.out.println(response.getEntity());
|
System.out.println(response.getEntity());
|
||||||
assertTrue(response.getEntity().toString().contains(" <type value=\"Patient\"/>"));
|
assertTrue(response.getEntity().toString().contains(" <type value=\"Patient\"/>"));
|
||||||
assertTrue(response.getEntity().toString().contains("\"$someCustomOperation"));
|
assertTrue(response.getEntity().toString().contains("\"someCustomOperation"));
|
||||||
System.out.println(response.getEntity());
|
System.out.println(response.getEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class SystemProviderDstu2Test extends BaseJpaDstu2Test {
|
||||||
try {
|
try {
|
||||||
String response = IOUtils.toString(http.getEntity().getContent());
|
String response = IOUtils.toString(http.getEntity().getContent());
|
||||||
ourLog.info(response);
|
ourLog.info(response);
|
||||||
assertThat(response, not(containsString("_format")));
|
assertThat(response, (containsString("_format=json")));
|
||||||
assertEquals(200, http.getStatusLine().getStatusCode());
|
assertEquals(200, http.getStatusLine().getStatusCode());
|
||||||
} finally {
|
} finally {
|
||||||
http.close();
|
http.close();
|
||||||
|
|
|
@ -315,7 +315,7 @@ public class SystemProviderDstu3Test extends BaseJpaDstu3Test {
|
||||||
try {
|
try {
|
||||||
String response = IOUtils.toString(http.getEntity().getContent());
|
String response = IOUtils.toString(http.getEntity().getContent());
|
||||||
ourLog.info(response);
|
ourLog.info(response);
|
||||||
assertThat(response, not(containsString("_format")));
|
assertThat(response, containsString("_format=json"));
|
||||||
assertEquals(200, http.getStatusLine().getStatusCode());
|
assertEquals(200, http.getStatusLine().getStatusCode());
|
||||||
} finally {
|
} finally {
|
||||||
http.close();
|
http.close();
|
||||||
|
@ -454,7 +454,7 @@ public class SystemProviderDstu3Test extends BaseJpaDstu3Test {
|
||||||
@Test
|
@Test
|
||||||
public void testGetOperationDefinition() {
|
public void testGetOperationDefinition() {
|
||||||
OperationDefinition op = ourClient.read(OperationDefinition.class, "get-resource-counts");
|
OperationDefinition op = ourClient.read(OperationDefinition.class, "get-resource-counts");
|
||||||
assertEquals("$get-resource-counts", op.getCode());
|
assertEquals("get-resource-counts", op.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -163,7 +163,7 @@ public class BaseDateTimeDtDstu2Test {
|
||||||
@Test
|
@Test
|
||||||
public void testParseIgnoresLeadingAndTrailingSpace() {
|
public void testParseIgnoresLeadingAndTrailingSpace() {
|
||||||
DateTimeDt dt = new DateTimeDt(" 2014-10-11T12:11:00Z ");
|
DateTimeDt dt = new DateTimeDt(" 2014-10-11T12:11:00Z ");
|
||||||
assertEquals("", myDateInstantZoneParser.format(dt.getValue()));
|
assertEquals("2014-10-11 10:11:00.000-0200", myDateInstantZoneParser.format(dt.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -164,17 +164,17 @@ public class OperationServerWithSearchParamTypesDstu2Test {
|
||||||
assertThat(conf, stringContainsInOrder(
|
assertThat(conf, stringContainsInOrder(
|
||||||
"<type value=\"Patient\"/>",
|
"<type value=\"Patient\"/>",
|
||||||
"<operation>",
|
"<operation>",
|
||||||
"<name value=\"$andlist\"/>"
|
"<name value=\"andlist\"/>"
|
||||||
));
|
));
|
||||||
assertThat(conf, stringContainsInOrder(
|
assertThat(conf, stringContainsInOrder(
|
||||||
"<type value=\"Patient\"/>",
|
"<type value=\"Patient\"/>",
|
||||||
"<operation>",
|
"<operation>",
|
||||||
"<name value=\"$nonrepeating\"/>"
|
"<name value=\"nonrepeating\"/>"
|
||||||
));
|
));
|
||||||
assertThat(conf, stringContainsInOrder(
|
assertThat(conf, stringContainsInOrder(
|
||||||
"<type value=\"Patient\"/>",
|
"<type value=\"Patient\"/>",
|
||||||
"<operation>",
|
"<operation>",
|
||||||
"<name value=\"$orlist\"/>"
|
"<name value=\"orlist\"/>"
|
||||||
));
|
));
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class ServerConformanceProviderDstu2Test {
|
||||||
ourLog.info(conf);
|
ourLog.info(conf);
|
||||||
|
|
||||||
assertEquals(1, conformance.getRest().get(0).getOperation().size());
|
assertEquals(1, conformance.getRest().get(0).getOperation().size());
|
||||||
assertEquals("$everything", conformance.getRest().get(0).getOperation().get(0).getName());
|
assertEquals("everything", conformance.getRest().get(0).getOperation().get(0).getName());
|
||||||
assertEquals("OperationDefinition/everything", conformance.getRest().get(0).getOperation().get(0).getDefinition().getReference().getValue());
|
assertEquals("OperationDefinition/everything", conformance.getRest().get(0).getOperation().get(0).getDefinition().getReference().getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -376,7 +376,7 @@ public class ResponseHighlightingInterceptorTest {
|
||||||
ourLog.info(output);
|
ourLog.info(output);
|
||||||
assertThat(output, containsString("<span class='hlTagName'>Patient</span>"));
|
assertThat(output, containsString("<span class='hlTagName'>Patient</span>"));
|
||||||
assertThat(output, not(stringContainsInOrder("<body>", "<pre>", "\n", "</pre>")));
|
assertThat(output, not(stringContainsInOrder("<body>", "<pre>", "\n", "</pre>")));
|
||||||
assertThat(output, containsString("<a href=\"?_raw=true\">"));
|
assertThat(output, containsString("<a href=\"?_format=json\">"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -174,18 +174,18 @@ public class OperationServerWithSearchParamTypesDstu3Test {
|
||||||
assertThat(conf, stringContainsInOrder(
|
assertThat(conf, stringContainsInOrder(
|
||||||
"<type value=\"Patient\"/>",
|
"<type value=\"Patient\"/>",
|
||||||
"<operation>",
|
"<operation>",
|
||||||
"<name value=\"$andlist\"/>",
|
"<name value=\"andlist\"/>",
|
||||||
"</operation>"
|
"</operation>"
|
||||||
));
|
));
|
||||||
assertThat(conf, stringContainsInOrder(
|
assertThat(conf, stringContainsInOrder(
|
||||||
"<type value=\"Patient\"/>",
|
"<type value=\"Patient\"/>",
|
||||||
"<operation>",
|
"<operation>",
|
||||||
"<name value=\"$nonrepeating\"/>"
|
"<name value=\"nonrepeating\"/>"
|
||||||
));
|
));
|
||||||
assertThat(conf, stringContainsInOrder(
|
assertThat(conf, stringContainsInOrder(
|
||||||
"<type value=\"Patient\"/>",
|
"<type value=\"Patient\"/>",
|
||||||
"<operation>",
|
"<operation>",
|
||||||
"<name value=\"$orlist\"/>"
|
"<name value=\"orlist\"/>"
|
||||||
));
|
));
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
|
|
|
@ -131,11 +131,10 @@ public class ServerConformanceProviderDstu3Test {
|
||||||
ourLog.info(conf);
|
ourLog.info(conf);
|
||||||
|
|
||||||
assertEquals(1, conformance.getRest().get(0).getOperation().size());
|
assertEquals(1, conformance.getRest().get(0).getOperation().size());
|
||||||
assertEquals("$everything", conformance.getRest().get(0).getOperation().get(0).getName());
|
assertEquals("everything", conformance.getRest().get(0).getOperation().get(0).getName());
|
||||||
assertEquals("$everything", ((OperationDefinition)conformance.getRest().get(0).getOperation().get(0).getDefinition().getResource()).getCode());
|
|
||||||
|
|
||||||
OperationDefinition opDef = sc.readOperationDefinition(new IdType("OperationDefinition/everything"));
|
OperationDefinition opDef = sc.readOperationDefinition(new IdType("OperationDefinition/everything"));
|
||||||
assertEquals("$everything", opDef.getCode());
|
assertEquals("everything", opDef.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -155,7 +154,7 @@ public class ServerConformanceProviderDstu3Test {
|
||||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(opDef);
|
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(opDef);
|
||||||
ourLog.info(conf);
|
ourLog.info(conf);
|
||||||
|
|
||||||
assertEquals("$everything", opDef.getCode());
|
assertEquals("everything", opDef.getCode());
|
||||||
assertEquals(true, opDef.getIdempotent());
|
assertEquals(true, opDef.getIdempotent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,15 +268,12 @@ public class ServerConformanceProviderDstu3Test {
|
||||||
|
|
||||||
rs.init(createServletConfig());
|
rs.init(createServletConfig());
|
||||||
|
|
||||||
Conformance sconf = sc.getServerConformance(createHttpServletRequest());
|
|
||||||
assertEquals("$plain", ((OperationDefinition)sconf.getRest().get(0).getOperation().get(0).getDefinition().getResource()).getCode());
|
|
||||||
|
|
||||||
OperationDefinition opDef = sc.readOperationDefinition(new IdType("OperationDefinition/plain"));
|
OperationDefinition opDef = sc.readOperationDefinition(new IdType("OperationDefinition/plain"));
|
||||||
|
|
||||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(opDef);
|
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(opDef);
|
||||||
ourLog.info(conf);
|
ourLog.info(conf);
|
||||||
|
|
||||||
assertEquals("$plain", opDef.getCode());
|
assertEquals("plain", opDef.getCode());
|
||||||
assertEquals(true, opDef.getIdempotent());
|
assertEquals(true, opDef.getIdempotent());
|
||||||
assertEquals(3, opDef.getParameter().size());
|
assertEquals(3, opDef.getParameter().size());
|
||||||
assertEquals("start", opDef.getParameter().get(0).getName());
|
assertEquals("start", opDef.getParameter().get(0).getName());
|
||||||
|
|
Loading…
Reference in New Issue