### Question:
Env { public String getString(String key) { return optString(key) .orElseThrow(() -> new IllegalArgumentException("Missing required env var: " + key)); } Env(Set<String> include);  Env(Set<String> include, String prefix); void requireAllVarsUsed(); boolean isEmpty(); boolean containsKey(String key); Optional<String> optString(String key); String getString(String key); String getString(String key, String defaultValue); List<String> getStrings(String key, List<String> defaultValue); Integer getInt(String key, Integer defaultValue); Long getLong(String key, Long defaultValue); Duration getDuration(String key, String defaultValue); Pattern getPattern(String key);  }### Answer:
@Test public void canRemovePrefix() { envVars.set("OUTPUT", "o"); envVars.set("ERROR_OUTPUT", "eo"); assertEquals("eo", new Env(ImmutableSet.of("OUTPUT"), "ERROR_").getString("OUTPUT")); }
@Test public void throwsMissingInclude() { envVars.set("OUTPUT", "o"); IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> new Env(ImmutableSet.of()).getString("OUTPUT")); assertEquals("key missing from include: OUTPUT", thrown.getMessage()); }
@Test public void throwsMissingRequired() { IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> new Env(ImmutableSet.of("OUTPUT")).getString("OUTPUT")); assertEquals("Missing required env var: OUTPUT", thrown.getMessage()); }