@Test
    void multipleInlineScriptsDifferentTypes() throws IOException {
        writer.startElement("body", null);
        verify(wrappedWriter).startElement("body", null);

        writer.startElement("script", null);
        writer.writeAttribute("type", "text/javascript", null);
        writer.writeText("javascript1", null);
        writer.endElement("script");

        writer.startElement("script", null);
        // default type is text/javascript
        writer.writeText("javascript2", null);
        writer.endElement("script");

        writer.startElement("script", null);
        writer.writeAttribute("type", "x-shader/x-vertex", null);
        writer.writeText("vertex", null);
        writer.endElement("script");

        writer.endElement("body");

        verify(wrappedWriter, times(2)).startElement("script", null);
        verify(wrappedWriter).write(matches("(?s).*javascript1.*javascript2(?!.*vertex.*).*"));
        verify(wrappedWriter).write(matches("(?s)(?!.*javascript.*).*vertex.*"));
        verify(wrappedWriter, times(2)).endElement("script");
    }
https://github.com/primefaces/primefaces/issues/3854
primefaces/src/test/java/org/primefaces/application/resource/MoveScriptsToBottomResponseWriterTest.java