From fb177d8a76118ad06acec25f098cd8a80ea2af5a Mon Sep 17 00:00:00 2001 From: dotasek Date: Thu, 20 Jan 2022 13:44:03 -0500 Subject: [PATCH] Add test for SimpleHttpClient and https --- .../fhir/utilities/SimpleHTTPClientTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/SimpleHTTPClientTest.java diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/SimpleHTTPClientTest.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/SimpleHTTPClientTest.java new file mode 100644 index 000000000..9a09bffe8 --- /dev/null +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/SimpleHTTPClientTest.java @@ -0,0 +1,23 @@ +package org.hl7.fhir.utilities; + +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SimpleHTTPClientTest { + @Test + public void testSimpleHTTPClient() throws IOException { + + SimpleHTTPClient http = new SimpleHTTPClient(); + String url = "https://hl7.org/fhir/us/core/package-list.json?nocache=" + System.currentTimeMillis(); + + SimpleHTTPClient.HTTPResult res = http.get(url, "application/json"); + + System.out.println(res.getCode()); + System.out.println(new String(res.getContent(), StandardCharsets.UTF_8)); + assertTrue(res.getCode() != 400); + } +} \ No newline at end of file