### Question:
LanguageDriverRegistry { public void register(Class<?> cls) { if (cls == null) { throw new IllegalArgumentException("null is not a valid Language Driver"); } if (!LANGUAGE_DRIVER_MAP.containsKey(cls)) { try { LANGUAGE_DRIVER_MAP.put(cls, (LanguageDriver) cls.newInstance()); } catch (Exception ex) { throw new ScriptingException("Failed to load language driver for " + cls.getName(), ex); } } }  void register(Class<?> cls); void register(LanguageDriver instance); LanguageDriver getDriver(Class<?> cls); LanguageDriver getDefaultDriver(); Class<?> getDefaultDriverClass(); void setDefaultDriverClass(Class<?> defaultDriverClass);  }### Answer:
@Test public void registerByTypeNull() { when(registry).register((Class<?>) null); then(caughtException()).isInstanceOf(IllegalArgumentException.class) .hasMessage("null is not a valid Language Driver"); }
@Test public void registerByTypeDoesNotCreateNewInstance() { when(registry).register(PrivateLanguageDriver.class); then(caughtException()).isInstanceOf(ScriptingException.class) .hasMessage("Failed to load language driver for org.apache.ibatis.scripting.LanguageDriverRegistryTest$PrivateLanguageDriver"); }
@Test public void registerByInstanceNull() { when(registry).register((LanguageDriver) null); then(caughtException()).isInstanceOf(IllegalArgumentException.class) .hasMessage("null is not a valid Language Driver"); }