### Question:
InversionServletConfig { public static String buildServletMapping(Engine engine) { List<String> parts = new ArrayList<>(); boolean done = false; for (int i = 0; i < 100 && !done; i++) { String part = null; for (Path path : engine.getIncludePaths()) { if (part == null) part = path.get(i); if (part == null || !path.isStatic(i) || !part.equals(path.get(i))) { done = true; break; } } if (part == null) break; if (!done) parts.add(part); } return (parts.size() > 0 ? ("/" + new Path(parts)) : "") + "/*"; }  static ServletRegistrationBean createDefaultInversionServlet(Engine engine); static String buildServletMapping(Engine engine); static ConfigurableServletWebServerFactory createDefaultServletContainer(); @Bean ServletRegistrationBean inversionServlet(@Autowired Engine engine); @Bean ConfigurableServletWebServerFactory servletContainer();  }### Answer:
@Test public void buildServletMapping_noCommonPath() { Engine e = new Engine().withIncludeOn(null, "/a/b/c", "/d/e/f"); assertEquals("/*", InversionServletConfig.buildServletMapping(e)); }
@Test public void buildServletMapping_partialCommonPath() { Engine e = new Engine().withIncludeOn(null, "/a/b/c", "/a/b/f"); assertEquals("/a/b/*", InversionServletConfig.buildServletMapping(e)); }
@Test public void buildServletMapping_breakOnOptional() { Engine e = new Engine().withIncludeOn(null, "/a/b/c", "/a/b/[c]"); assertEquals("/a/b/*", InversionServletConfig.buildServletMapping(e)); }
@Test public void buildServletMapping_breakOnVariable() { Engine e = new Engine().withIncludeOn(null, "/a/b/c", "/a/b/:c"); assertEquals("/a/b/*", InversionServletConfig.buildServletMapping(e)); }
@Test public void buildServletMapping_breakOnRegex() { Engine e = new Engine().withIncludeOn(null, "/a/b/c", "/a/b/{c}"); assertEquals("/a/b/*", InversionServletConfig.buildServletMapping(e)); }