public class JSStringTransformerTest
extends junit.framework.TestCase
Modifier and Type | Class and Description |
---|---|
static class |
JSStringTransformerTest.RecordingReplayParseContext
ReplayParseContext mock
TODO: move to package-level as this is useful for testing other
StringTransformer s. |
Constructor and Description |
---|
JSStringTransformerTest() |
Modifier and Type | Method and Description |
---|---|
protected void |
setUp() |
void |
testRewriteHttpsOnly()
rewriteHttpsOnly property is used to limit URL rewrite
to HTTPS ones (intended for proxy mode). |
void |
testRewriteHttpsOnlyEscapedSlashes()
same as above, slashes are backslash-escaped.
|
void |
testRewriteProtocolRelativeWithCustomRegex()
test of rewriting protocol relative URLs (
"//www.example.com/..." ) |
void |
testRewriteSpecialCharURL()
test of rewriting corner case where URL contains special chars for
Matcher#appendReplacement . |
void |
testTransform_EscapedSlashes()
slash is often escaped with backslash in JavaScript (esp.
|
void |
testTransform_HostOnly()
|
void |
testTransform_WithPath() |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
protected void setUp() throws Exception
setUp
in class junit.framework.TestCase
Exception
public void testTransform_HostOnly() throws MalformedURLException
JSStringTransformer.transform(org.archive.wayback.replay.html.ReplayParseContext, java.lang.String)
.MalformedURLException
public void testTransform_WithPath()
public void testTransform_EscapedSlashes()
public void testRewriteHttpsOnly() throws Exception
rewriteHttpsOnly
property is used to limit URL rewrite
to HTTPS ones (intended for proxy mode). That should affect how
StringTransformer picks up URLs in text for translation.
Now rewriteHttpsOnly
has no effect on JSStringTransformer
's
behavior and picks up all fulll URLs.
Exception
public void testRewriteHttpsOnlyEscapedSlashes() throws Exception
Exception
public void testRewriteProtocolRelativeWithCustomRegex() throws Exception
"//www.example.com/..."
)
with non-default regex.
check if text preceding the first group is preserved in the result. also make sure it works with URLs with protocol.
Exception
Copyright © 2005–2015 IIPC. All rights reserved.