updating unit tests so they pass on my mac. Also updating test to Junit5
This commit is contained in:
parent
17eb1c41f7
commit
3c614058f7
|
@ -107,6 +107,14 @@
|
||||||
<version>${validator_test_case_version}</version>
|
<version>${validator_test_case_version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JUNIT JUPITER (JUNIT5) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>5.6.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.atlassian.commonmark</groupId>
|
<groupId>com.atlassian.commonmark</groupId>
|
||||||
<artifactId>commonmark</artifactId>
|
<artifactId>commonmark</artifactId>
|
||||||
|
|
|
@ -36,7 +36,9 @@ public class BaseDateTimeTypeTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void equalsUsingFhirPathRulesOther() {
|
public void equalsUsingFhirPathRulesOther() {
|
||||||
|
// Setting timezone for this test. Grahame is in UTC+11, Travis is in GMT, and I'm here in Toronto, Canada with
|
||||||
|
// all my time based tests failing locally...
|
||||||
|
TimeZone.setDefault(TimeZone.getTimeZone("UTC+1100"));
|
||||||
|
|
||||||
// Exact same - Same timezone
|
// Exact same - Same timezone
|
||||||
assertTrue( compareDateTimes("2001-01-02T11:22:33.444Z", "2001-01-02T11:22:33.444Z"));
|
assertTrue( compareDateTimes("2001-01-02T11:22:33.444Z", "2001-01-02T11:22:33.444Z"));
|
||||||
|
|
|
@ -147,6 +147,9 @@ public class FHIRPathTests {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void test() throws FileNotFoundException, IOException, FHIRException, org.hl7.fhir.exceptions.FHIRException, UcumException {
|
public void test() throws FileNotFoundException, IOException, FHIRException, org.hl7.fhir.exceptions.FHIRException, UcumException {
|
||||||
|
// Setting timezone for this test. Grahame is in UTC+11, Travis is in GMT, and I'm here in Toronto, Canada with
|
||||||
|
// all my time based tests failing locally...
|
||||||
|
TimeZone.setDefault(TimeZone.getTimeZone("UTC+1100"));
|
||||||
|
|
||||||
if (fp == null)
|
if (fp == null)
|
||||||
fp = new FHIRPathEngine(TestingUtilities.context());
|
fp = new FHIRPathEngine(TestingUtilities.context());
|
||||||
|
|
|
@ -1,19 +1,34 @@
|
||||||
package org.hl7.fhir.r5.test;
|
package org.hl7.fhir.r5.test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.lang3.SystemUtils;
|
import org.apache.commons.lang3.SystemUtils;
|
||||||
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@DisplayName("Path Tests")
|
||||||
public class UtilitiesTests {
|
public class UtilitiesTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPath() throws IOException {
|
@DisplayName("Tests java temp directory is created correctly")
|
||||||
Assert.assertEquals(Utilities.path("[tmp]", "test.txt"), SystemUtils.IS_OS_WINDOWS ? "c:\\temp\\test.txt" : "/temp/test.txt");
|
public void testTempDir() throws IOException {
|
||||||
Assert.assertEquals(Utilities.path("[user]", "test.txt"), System.getProperty("user.home")+"\\test.txt");
|
Assertions.assertEquals(Utilities.path("[tmp]", "test.txt"), SystemUtils.IS_OS_WINDOWS ? "c:\\temp\\test.txt" : System.getProperty("java.io.tmpdir") + "test.txt");
|
||||||
Assert.assertEquals(Utilities.path("[JAVA_HOME]", "test.txt"), System.getenv("JAVA_HOME")+"\\test.txt");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Tests user system property is correct")
|
||||||
|
public void testUserDir() throws IOException {
|
||||||
|
Assertions.assertEquals(Utilities.path("[user]", "test.txt"), SystemUtils.IS_OS_WINDOWS ? System.getProperty("user.home") + "\\test.txt" : System.getProperty("user.home") + "/test.txt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Tests JAVA_HOME is initialized correctly")
|
||||||
|
public void testJavaHome() throws IOException {
|
||||||
|
Assertions.assertEquals(Utilities.path("[JAVA_HOME]", "test.txt"), SystemUtils.IS_OS_WINDOWS ? System.getenv("JAVA_HOME") + "\\test.txt" : System.getenv("JAVA_HOME") + "/test.txt");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue