Skip to content

Commit

Permalink
fix: trying to hush the linter precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
at88mph committed Jan 7, 2025
1 parent 52b590a commit 21ba10c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class GetActionTest {
public static final String REDIS_PORT = "6129";

@Before
public void setUp() {
public void setUp() throws Exception {
TestUtils.setEnv("REDIS_HOST", GetActionTest.REDIS_HOST);
TestUtils.setEnv("REDIS_PORT", GetActionTest.REDIS_PORT);

Expand Down
18 changes: 7 additions & 11 deletions skaha/src/test/java/org/opencadc/skaha/utils/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,12 @@ public static <T> void set(T object, Class<?> className, String propertyName, Ob
}
}

public static void setEnv(String key, String value) {
try {
Map<String, String> env = System.getenv();
Class<?> clazz = env.getClass();
Field field = clazz.getDeclaredField("m");
field.setAccessible(true);
Map<String, String> writableEnv = (Map<String, String>) field.get(env);
writableEnv.put(key, value);
} catch (Exception e) {
throw new IllegalArgumentException("Failed to set environment variable", e);
}
public static void setEnv(String key, String value) throws Exception {
Map<String, String> env = System.getenv();
Class<?> clazz = env.getClass();
Field field = clazz.getDeclaredField("m");
field.setAccessible(true);
Map<String, String> writableEnv = (Map<String, String>) field.get(env);
writableEnv.put(key, value);
}
}

0 comments on commit 21ba10c

Please sign in to comment.