// Path: core/src/main/java/org/owasp/encoder/JavaScriptEncoder.java
// enum Mode {
//     /**
//      * Standard encoding of JavaScript Strings. Escape sequences are chosen
//      * according to what is the shortest sequence possible for the
//      * character.
//      */
//     SOURCE,
//     /**
//      * Encoding for use in HTML attributes. Quote characters are escaped
//      * using hex encodes instead of backslashes. The alternate would be to
//      * use a sequence of encodes that would actually be longer. In this mode
//      * double-quote is "\x22" and single-quote is "\x27". (In HTML
//      * attributes the alternate would be encoding "\"" and "\'" with entity
//      * escapes to "\&amp;#34;" and "\&amp;39;").
//      */
//     ATTRIBUTE,
//     /**
//      * Encoding for use in HTML script blocks. The main concern here is
//      * permaturely terminating a script block with a closing "&lt;/" inside
//      * the string. This encoding escapes "/" as "\/" to prevent such
//      * termination.
//      */
//     BLOCK,
//     /**
//      * Encodes for use in either HTML script attributes or blocks.
//      * Essentially this is both special escapes from HTML_ATTRIBUTE and
//      * HTML_CONTENT combined.
//      */
//     HTML,;
// }


import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.owasp.encoder.JavaScriptEncoder.Mode;
                    builder
                        .encode("\\\"", "\"")
                        .encode("\\\'", "\'");
                    break;
                case HTML:
                case ATTRIBUTE:
                    builder
                        .encode("\\x22", "\"")
                        .encode("\\x27", "\'");
                    break;
                default:
                    throw new AssertionError("unexpected mode: "+mode);
                }

                switch (mode) {
                case BLOCK:
                case HTML:
                    builder
                        .encode("\\/", "/")
                        .encode("\\-", "-")
                        .encoded("/-");
                    break;
                default:
                    builder.encode("/", "/");
                    break;
                }
                if (mode != Mode.SOURCE) {
                    builder.encoded("&");
                }

// Path: core/src/main/java/org/owasp/encoder/JavaScriptEncoder.java
// enum Mode {
//     /**
//      * Standard encoding of JavaScript Strings. Escape sequences are chosen
//      * according to what is the shortest sequence possible for the
//      * character.
//      */
//     SOURCE,
//     /**
//      * Encoding for use in HTML attributes. Quote characters are escaped
//      * using hex encodes instead of backslashes. The alternate would be to
//      * use a sequence of encodes that would actually be longer. In this mode
//      * double-quote is "\x22" and single-quote is "\x27". (In HTML
//      * attributes the alternate would be encoding "\"" and "\'" with entity
//      * escapes to "\&amp;#34;" and "\&amp;39;").
//      */
//     ATTRIBUTE,
//     /**
//      * Encoding for use in HTML script blocks. The main concern here is
//      * permaturely terminating a script block with a closing "&lt;/" inside
//      * the string. This encoding escapes "/" as "\/" to prevent such
//      * termination.
//      */
//     BLOCK,
//     /**
//      * Encodes for use in either HTML script attributes or blocks.
//      * Essentially this is both special escapes from HTML_ATTRIBUTE and
//      * HTML_CONTENT combined.
//      */
//     HTML,;
// }


// Path: core/src/test/java/org/owasp/encoder/JavaScriptEncoderTest.java
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.owasp.encoder.JavaScriptEncoder.Mode;

                    builder
                        .encode("\\\"", "\"")
                        .encode("\\\'", "\'");
                    break;
                case HTML:
                case ATTRIBUTE:
                    builder
                        .encode("\\x22", "\"")
                        .encode("\\x27", "\'");
                    break;
                default:
                    throw new AssertionError("unexpected mode: "+mode);
                }

                switch (mode) {
                case BLOCK:
                case HTML:
                    builder
                        .encode("\\/", "/")
                        .encode("\\-", "-")
                        .encoded("/-");
                    break;
                default:
                    builder.encode("/", "/");
                    break;
                }
                if (mode != Mode.SOURCE) {
                    builder.encoded("&");
                }

                builder