WebComponentGenerator { public static String generateModule( WebComponentExporterFactory<? extends Component> factory, String frontendURI, boolean compatibilityMode) { Objects.requireNonNull(factory); Objects.requireNonNull(frontendURI); WebComponentConfiguration<? extends Component> config = new WebComponentExporter.WebComponentConfigurationFactory() .create(factory.create()); return generateModule(config, frontendURI, false, compatibilityMode); } private  WebComponentGenerator(); static String generateModule(
            WebComponentExporterFactory<? extends Component> factory,
            String frontendURI, boolean compatibilityMode); static String generateModule(
            WebComponentConfiguration<? extends Component> webComponentConfiguration,
            String frontendURI, boolean compatibilityMode);  }
@Test public void providesHTMLModuleInBowerMode() { String module = WebComponentGenerator.generateModule( new DefaultWebComponentExporterFactory<MyComponent>( MyComponentExporter.class), "", true); module = module.replace("\r", ""); Assert.assertThat(module, startsWith( "\n" + "<script>\n" + " class Tag extends HTMLElement {\n")); Assert.assertThat(module, containsString("customElements.define('tag', Tag);\n")); }
@Test public void providesJSModulesInNpmMode() { String module = WebComponentGenerator.generateModule( new DefaultWebComponentExporterFactory<MyComponent>( MyComponentExporter.class), "", false); module = module.replace("\r", ""); Assert.assertThat(module, startsWith("class Tag extends HTMLElement {")); Assert.assertThat(module, containsString("style.innerHTML = `\n" + " :host {\n" + " position: relative;\n" + " display: inline-block;\n" + " }\n" + " `;\n")); Assert.assertThat(module, containsString("customElements.define('tag', Tag);\n")); }