@Test
    public void canIntegrateSectionsWithComplexStates() {
        CodeWriter writer = CodeWriter.createDefault();

        writer.onSection("foo", text -> writer.write("Intercepted: " + text + "!\nYap!"));

        writer.onSection("indented", text -> {
            writer.indent();
            writer.write("This is indented, in flow of parent.\nYap!");
            writer.write("Yap?");
            writer.setNewlinePrefix("# ");
            writer.write("Has a prefix\nYes");
        });

        writer.pushState();
        writer.write("/**");
        writer.setNewlinePrefix(" * ");

        writer.pushState("no_interceptors");
        writer.write("Hi!");
        writer.popState();

        writer.write("");

        writer.pushState("foo");
        writer.writeInline("baz");
        writer.popState();

        writer.pushState("indented").popState();

        writer.popState();
        writer.write(" */");

        assertThat(writer.toString(),
                equalTo(
                        "/**\n"
                                + " * Hi!\n"
                                + " *\n"
                                + " * Intercepted: baz!\n"
                                + " * Yap!\n"
                                + " *     This is indented, in flow of parent.\n"
                                + " *     Yap!\n"
                                + " *     Yap?\n"
                                + " *     # Has a prefix\n"
                                + " *     # Yes\n"
                                + " */\n"));
    }
\n     * This is some docs.\n     * And more docs.\n     *\n     * Foo.\n
smithy-utils/src/test/java/software/amazon/smithy/utils/CodeWriterTest.java