Skip to content

Commit 85aab81

Browse files
committed
add comments to explain non-intuitive logic in test
1 parent 04de3e7 commit 85aab81

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ void beforeEach() {
8888

8989
private Boolean hasCdsServices() throws IOException {
9090
var response = callCdsServicesDiscovery();
91+
92+
// NOTE: this is looking for a repsonse that indicates there are CDS services availalble.
93+
// And empty response looks like: {"services": []}
94+
// Looking at the actual response string consumes the InputStream which has side-effects, making it tricky to compare the actual contents.
95+
// Hence the test just looks at the length to make this determination.
96+
// The actual response has newlines in it which vary in size on some systems, but a value of 25 seems to work across linux/mac/windows
97+
// to ensure the repsonse actually contains CDS services in it
9198
return response.getEntity().getContentLength() > 25 || response.getEntity().isChunked();
9299
}
93100

0 commit comments

Comments
 (0)