ServletInitializationParameters { public static ServletInitializationParameters fromServletConfig( ServletConfig config, ClassLoader classLoader) throws ServletException { Builder builder = builder(); if (config != null) { String serviceClassNames = config.getInitParameter(SERVICES); if (serviceClassNames != null) { for (String serviceClassName : CSV_SPLITTER.split(serviceClassNames)) { builder.addServiceClass(getClassForName(serviceClassName, classLoader)); } } String servletRestricted = config.getInitParameter(RESTRICTED); if (servletRestricted != null) { builder.setServletRestricted(parseBoolean(servletRestricted, RESTRICTED)); } String clientIdWhitelist = config.getInitParameter(CLIENT_ID_WHITELIST_ENABLED); if (clientIdWhitelist != null) { builder.setClientIdWhitelistEnabled( parseBoolean(clientIdWhitelist, CLIENT_ID_WHITELIST_ENABLED)); } String illegalArgumentBackendError = config.getInitParameter(ILLEGAL_ARGUMENT_BACKEND_ERROR); if (illegalArgumentBackendError != null) { builder.setIllegalArgumentBackendError( parseBoolean(illegalArgumentBackendError, ILLEGAL_ARGUMENT_BACKEND_ERROR)); } String exceptionCompatibility = config.getInitParameter(EXCEPTION_COMPATIBILITY); if (exceptionCompatibility != null) { builder.setExceptionCompatibilityEnabled( parseBoolean(exceptionCompatibility, EXCEPTION_COMPATIBILITY)); } String prettyPrint = config.getInitParameter(PRETTY_PRINT); if (prettyPrint != null) { builder.setPrettyPrintEnabled(parseBoolean(prettyPrint, PRETTY_PRINT)); } String addContentLength = config.getInitParameter(ADD_CONTENT_LENGTH); if (addContentLength != null) { builder.setAddContentLength(parseBoolean(addContentLength, ADD_CONTENT_LENGTH)); } } return builder.build(); }  abstract ImmutableSet<Class<?>> getServiceClasses(); @Deprecated abstract boolean isServletRestricted(); abstract boolean isClientIdWhitelistEnabled(); abstract boolean isIllegalArgumentBackendError(); abstract boolean isExceptionCompatibilityEnabled(); abstract boolean isPrettyPrintEnabled(); abstract boolean isAddContentLength(); static Builder builder(); static ServletInitializationParameters fromServletConfig(
      ServletConfig config, ClassLoader classLoader); ImmutableMap<String, String> asMap();  }
@Test public void testFromServletConfig_invalidRestrictedThrows() throws ServletException { try { fromServletConfig(null, "yes", null, null, null, null, null); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } }