### Question:
UndertowServletMapper implements Function<ServletDescriptor, ServletInfo> { @Override public ServletInfo apply(ServletDescriptor servletDescriptor) { ServletInfo servletInfo = Servlets.servlet(servletDescriptor.name(), servletDescriptor.servletClass()) .setAsyncSupported(servletDescriptor.asyncSupported()) .setLoadOnStartup(servletDescriptor.loadOnStartup()) .addMappings(servletDescriptor.urlPatterns()); if(servletDescriptor.initParams() != null) { for(WebInitParam param : servletDescriptor.initParams()) { servletInfo.addInitParam(param.name(), param.value()); } } return servletInfo; }  @Override ServletInfo apply(ServletDescriptor servletDescriptor);  }### Answer:
@Test public void testConversion() { Class<? extends HttpServlet> servletClass = DefaultServlet.class; String name = "name"; String[] value = new String[]{"a"}; String[] urlPatterns = new String[]{"/b"}; int loadOnStartup = 2; WebInitParam[] initParams = new WebInitParam[]{new WebParam("name","value")}; boolean asyncSupported = true; ServletDescriptor servletDescriptor = new ServletDescriptor(name, value, urlPatterns, loadOnStartup, initParams, asyncSupported, servletClass); ServletInfo servletInfo = mapper.apply(servletDescriptor); assertThat(servletInfo.getName()).isEqualTo(name); assertThat(servletInfo.getServletClass()).isEqualTo(servletClass); assertThat(servletInfo.getMappings()).isEqualTo(asList(urlPatterns)); assertThat(servletInfo.getLoadOnStartup()).isEqualTo(loadOnStartup); assertThat(servletInfo.isAsyncSupported()).isEqualTo(asyncSupported); assertThat(servletInfo.getInitParams()).isEqualTo(singletonMap("name","value")); }