### Question:
Server { public void setService(Class<? extends Service> klass) throws ServerException { ensureOperational(); Check.notNull(klass, "serviceKlass"); if (getStatus() == Status.SHUTTING_DOWN) { throw new IllegalStateException("Server shutting down"); } try { Service newService = klass.newInstance(); Service oldService = services.get(newService.getInterface()); if (oldService != null) { try { oldService.destroy(); } catch (Throwable ex) { log.error("Could not destroy service [{}], {}", new Object[]{oldService.getInterface(), ex.getMessage(), ex}); } } newService.init(this); services.put(newService.getInterface(), newService); } catch (Exception ex) { log.error("Could not set service [{}] programmatically -server shutting down-, {}", klass, ex); destroy(); throw new ServerException(ServerException.ERROR.S09, klass, ex.getMessage(), ex); } } Server(String name, String homeDir);  Server(String name, String homeDir, String configDir, String logDir, String tempDir);  Server(String name, String homeDir, Configuration config);  Server(String name, String homeDir, String configDir, String logDir, String tempDir, Configuration config); Status getStatus(); void setStatus(Status status); void init(); void destroy(); String getName(); String getPrefix(); String getPrefixedName(String name); String getHomeDir(); String getConfigDir(); String getLogDir(); String getTempDir(); Configuration getConfig(); @SuppressWarnings("unchecked") T get(Class<T> serviceKlass); void setService(Class<? extends Service> klass); static final String CONF_SERVICES; static final String CONF_SERVICES_EXT; static final String CONF_STARTUP_STATUS; static final String DEFAULT_LOG4J_PROPERTIES; }### Answer:
@Test(expected = IllegalStateException.class) @TestDir public void illegalState3() throws Exception { Server server = new Server("server", TestDirHelper.getTestDir().getAbsolutePath(), new Configuration(false)); server.setService(null); }