### Question:
JaasContext { public static JaasContext load(JaasContext.Type contextType, ListenerName listenerName, Map<String, ?> configs) { String listenerContextName; String globalContextName; switch (contextType) { case CLIENT: if (listenerName != null) throw new IllegalArgumentException("listenerName should be null for CLIENT"); globalContextName = GLOBAL_CONTEXT_NAME_CLIENT; listenerContextName = null; break; case SERVER: if (listenerName == null) throw new IllegalArgumentException("listenerName should not be null for SERVER"); globalContextName = GLOBAL_CONTEXT_NAME_SERVER; listenerContextName = listenerName.value().toLowerCase(Locale.ROOT) + "." + GLOBAL_CONTEXT_NAME_SERVER; break; default: throw new IllegalArgumentException("Unexpected context type " + contextType); } return load(contextType, listenerContextName, globalContextName, configs); } JaasContext(String name, Type type, Configuration configuration); static JaasContext load(JaasContext.Type contextType, ListenerName listenerName,
                                   Map<String, ?> configs); String name(); Type type(); Configuration configuration(); List<AppConfigurationEntry> configurationEntries(); String configEntryOption(String key, String loginModuleName);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testLoadForServerWithWrongListenerName() throws IOException { writeConfiguration("Server", "test.LoginModule required;"); JaasContext.load(JaasContext.Type.SERVER, new ListenerName("plaintext"), Collections.<String, Object>emptyMap()); }
@Test(expected = IllegalArgumentException.class) public void testLoadForClientWithListenerName() { JaasContext.load(JaasContext.Type.CLIENT, new ListenerName("foo"), Collections.<String, Object>emptyMap()); }