public class JavaScriptStringTest extends TestCase {
private void test(String original) throws IOException {
String escaped = StringUtils.javaScriptString(original);
// Parse it back
TokenStream tokenStream = new TokenStream(new StringReader(escaped),
"virtual file", 1);
assertEquals(TokenStream.STRING, tokenStream.getToken());
assertEquals(original, tokenStream.getString());
// It should be the only token
assertEquals(TokenStream.EOF, tokenStream.getToken());
}