From 135b5575f672325809b3f3f60d551471df163857 Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Fri, 1 Sep 2023 11:01:56 -0600 Subject: [PATCH] use data path check --- .../earthquake/nshmp/model/NshmTests.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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 68417b07..414c7888 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(); } } -- GitLab