EnvironmentHomeDetector implements HomeDetector { @Override public File detect() { if (!environment.containsKey(VARIABLE)) return null; String value = environment.get(VARIABLE); log.info("Using Oxalis folder specified as environment variable '{}' with value '{}'.", VARIABLE, value); return new File(value); } EnvironmentHomeDetector(Map<String, String> environment); @SuppressWarnings("unused")  EnvironmentHomeDetector(); @Override File detect();  }
@Test public void notFound() { HomeDetector homeDetector = new EnvironmentHomeDetector(Collections.emptyMap()); assertNull(homeDetector.detect()); }
@Test public void found() { HomeDetector homeDetector = new EnvironmentHomeDetector( Collections.singletonMap(EnvironmentHomeDetector.VARIABLE, "/tmp")); assertNotNull(homeDetector.detect()); }