diff --git a/src/test/java/gov/usgs/earthquake/nshmp/model/NshmTests.java b/src/test/java/gov/usgs/earthquake/nshmp/model/NshmTests.java index 68417b075160be6bfcaf537e1df2d2d40a7d6b90..414c788834b782b37c9b37f9344ab9a1a043620c 100644 --- a/src/test/java/gov/usgs/earthquake/nshmp/model/NshmTests.java +++ b/src/test/java/gov/usgs/earthquake/nshmp/model/NshmTests.java @@ -1,6 +1,7 @@ package gov.usgs.earthquake.nshmp.model; import java.io.IOException; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; @@ -120,7 +121,8 @@ class NshmTests { */ @Test final void testAlaska2007() throws IOException { - NshmTestUtils.testNshm(NSHMS.get("nshm-alaska-2007"), getDataPath()); + Nshm nshm = NSHMS.get("nshm-alaska-2007"); + NshmTestUtils.testNshm(nshm, getDataPath(nshm)); } /** @@ -130,7 +132,8 @@ class NshmTests { */ @Test final void testAlaska2023() throws IOException { - NshmTestUtils.testNshm(NSHMS.get("nshm-alaska-2023"), getDataPath()); + Nshm nshm = NSHMS.get("nshm-alaska-2023"); + NshmTestUtils.testNshm(nshm, getDataPath(nshm)); } /** @@ -140,7 +143,8 @@ class NshmTests { */ @Test final void testConus2018() throws IOException { - NshmTestUtils.testNshm(NSHMS.get("nshm-conus-2018"), getDataPath()); + Nshm nshm = NSHMS.get("nshm-conus-2018"); + NshmTestUtils.testNshm(nshm, getDataPath(nshm)); } /** @@ -150,7 +154,8 @@ class NshmTests { */ @Test final void testConus2023() throws IOException { - NshmTestUtils.testNshm(NSHMS.get("nshm-conus-2023"), getDataPath()); + Nshm nshm = NSHMS.get("nshm-conus-2023"); + NshmTestUtils.testNshm(nshm, getDataPath(nshm)); } /** @@ -160,10 +165,11 @@ class NshmTests { */ @Test final void testHawaii2021() throws IOException { - NshmTestUtils.testNshm(NSHMS.get("nshm-hawaii-2021"), getDataPath()); + Nshm nshm = NSHMS.get("nshm-hawaii-2021"); + NshmTestUtils.testNshm(nshm, getDataPath(nshm)); } - private static Optional<Path> getDataPath() { - return System.getenv("GITLAB_CI") != null ? Optional.of(DATA_PATH) : Optional.empty(); + private static Optional<Path> getDataPath(Nshm nshm) { + return Files.exists(DATA_PATH.resolve(nshm.modelName())) ? Optional.of(DATA_PATH) : Optional.empty(); } }