Skip to content

Commit 337c641

Browse files
committed
Fix Error.stack
1 parent 1318dcc commit 337c641

24 files changed

+195
-107
lines changed

src/test/java/net/sourceforge/htmlunit/ArgumentsTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.sourceforge.htmlunit;
22

3-
import org.junit.Assert;
3+
import static org.junit.Assert.assertEquals;
4+
45
import org.junit.Test;
56
import org.mozilla.javascript.Context;
67
import org.mozilla.javascript.ContextAction;
@@ -137,7 +138,7 @@ protected boolean hasFeature(final Context cx, final int featureIndex) {
137138
public Object run(final Context cx) {
138139
final Scriptable scope = cx.initStandardObjects();
139140
final Object result = cx.evaluateString(scope, script, "test.js", 1, null);
140-
Assert.assertEquals(expectedResult, result);
141+
assertEquals(expectedResult, result);
141142
return null;
142143
}
143144
};
@@ -178,7 +179,7 @@ public Object run(final Context cx) {
178179
try {
179180
Scriptable scope = cx.initStandardObjects();
180181
final Object o = cx.evaluateString(scope, script, "test_script", 1, null);
181-
Assert.assertEquals(expected, o);
182+
assertEquals(expected, o);
182183
return o;
183184
} catch (final Exception e) {
184185
throw new RuntimeException(e);

src/test/java/net/sourceforge/htmlunit/ContextMethodsTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package net.sourceforge.htmlunit;
22

3+
import static org.junit.Assert.assertEquals;
4+
35
import java.util.ArrayList;
46
import java.util.Arrays;
57
import java.util.List;
68

7-
import org.junit.Assert;
89
import org.junit.Test;
910
import org.mozilla.javascript.Context;
1011
import org.mozilla.javascript.ContextAction;
@@ -59,6 +60,6 @@ public Object run(Context cx) {
5960
cf.call(action);
6061

6162
final String[] expected = { "eval('1 + 2')", "1 + 2" };
62-
Assert.assertEquals(Arrays.asList(expected), compiled);
63+
assertEquals(Arrays.asList(expected), compiled);
6364
}
6465
}

src/test/java/net/sourceforge/htmlunit/DecompileTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.sourceforge.htmlunit;
22

3-
import org.junit.Assert;
3+
import static org.junit.Assert.assertEquals;
4+
45
import org.junit.Test;
56
import org.mozilla.javascript.Context;
67
import org.mozilla.javascript.ContextAction;
@@ -23,7 +24,7 @@ public void newObject0Arg() {
2324
@Override
2425
public Object run(final Context cx) {
2526
final Script script = cx.compileString(source, "my script", 0, null);
26-
Assert.assertEquals(source, cx.decompileScript(script, 4).trim());
27+
assertEquals(source, cx.decompileScript(script, 4).trim());
2728
return null;
2829
}
2930
};

src/test/java/net/sourceforge/htmlunit/DelegatorAndHostObjectTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.sourceforge.htmlunit;
22

3-
import org.junit.Assert;
3+
import static org.junit.Assert.assertEquals;
4+
45
import org.junit.Test;
56
import org.mozilla.javascript.Context;
67
import org.mozilla.javascript.ContextAction;
@@ -89,7 +90,7 @@ public Object run(final Context cx) {
8990
Scriptable scope = cx.initStandardObjects();
9091
ScriptableObject.defineClass(scope, MyHostObject.class);
9192
final Object o = cx.evaluateString(scope, script, "test_script", 1, null);
92-
Assert.assertEquals(expected, o);
93+
assertEquals(expected, o);
9394
return o;
9495
} catch (final Exception e) {
9596
throw new RuntimeException(e);

src/test/java/net/sourceforge/htmlunit/EvalScopeTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package net.sourceforge.htmlunit;
22

3+
import static org.junit.Assert.assertEquals;
4+
35
import java.lang.reflect.Method;
46

5-
import org.junit.Assert;
67
import org.junit.Test;
78
import org.mozilla.javascript.Context;
89
import org.mozilla.javascript.ContextAction;
@@ -79,7 +80,7 @@ public Object run(final Context cx) {
7980
if (result instanceof Number) {
8081
result = ((Number) result).intValue();
8182
}
82-
Assert.assertEquals(expected, result.toString());
83+
assertEquals(expected, result.toString());
8384
return null;
8485
}
8586
catch (final Exception e) {

src/test/java/net/sourceforge/htmlunit/ExceptionMessageTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package net.sourceforge.htmlunit;
22

3+
import static org.junit.Assert.assertEquals;
4+
35
import java.lang.reflect.Method;
46
import java.util.Locale;
57

6-
import org.junit.Assert;
78
import org.junit.BeforeClass;
89
import org.junit.Test;
910
import org.mozilla.javascript.Context;
@@ -47,7 +48,7 @@ public Object run(final Context cx) {
4748
throw new RuntimeException("Should have failed!");
4849
}
4950
catch (final EcmaError e) {
50-
Assert.assertEquals(expectedMesage + " (test_script#1)", e.getMessage());
51+
assertEquals(expectedMesage + " (test_script#1)", e.getMessage());
5152
return null;
5253
}
5354
catch (final Exception e) {
@@ -98,7 +99,7 @@ public Object run(final Context cx) {
9899
throw new RuntimeException("Should have failed!");
99100
}
100101
catch (final EcmaError e) {
101-
Assert.assertEquals("TypeError: Cannot set property [MyHostObject].readonlyProp that has only a getter to 123. (test_script#1)", e.getMessage());
102+
assertEquals("TypeError: Cannot set property [MyHostObject].readonlyProp that has only a getter to 123. (test_script#1)", e.getMessage());
102103
return null;
103104
}
104105
catch (final Exception e) {

src/test/java/net/sourceforge/htmlunit/ExceptionPropertiesTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.sourceforge.htmlunit;
22

3-
import org.junit.Assert;
3+
import static org.junit.Assert.assertEquals;
4+
45
import org.junit.Test;
56
import org.mozilla.javascript.Context;
67
import org.mozilla.javascript.ContextAction;
@@ -38,7 +39,7 @@ private static void testScriptStackTrace(final String script, final String expec
3839
Utilities.executeScript(script, optimizationLevel);
3940
}
4041
catch (final RhinoException e) {
41-
Assert.assertEquals(expectedStackTrace, e.getScriptStackTrace());
42+
assertEquals(expectedStackTrace, e.getScriptStackTrace());
4243
}
4344
}
4445

@@ -73,7 +74,7 @@ public Object run(final Context cx) {
7374
final ScriptableObject scope = cx.initStandardObjects();
7475
final Object o = cx.evaluateString(scope, script,
7576
"myScript.js", 1, null);
76-
Assert.assertEquals(expected, o);
77+
assertEquals(expected, o);
7778
return o;
7879
}
7980
catch (final RuntimeException e) {

src/test/java/net/sourceforge/htmlunit/FunctionCallerTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.sourceforge.htmlunit;
22

3-
import org.junit.Assert;
3+
import static org.junit.Assert.assertEquals;
4+
45
import org.junit.Test;
56
import org.mozilla.javascript.Context;
67
import org.mozilla.javascript.ContextAction;
@@ -29,7 +30,7 @@ public void upperScopeVarShouldntBeSetWithVarFunctionWithSameName() throws Excep
2930
public Object run(final Context cx) {
3031
final Scriptable scope = cx.initStandardObjects();
3132
final Object result = cx.evaluateString(scope, script, "test.js", 1, null);
32-
Assert.assertEquals(Boolean.TRUE, result);
33+
assertEquals(Boolean.TRUE, result);
3334
return null;
3435
}
3536
};
@@ -56,7 +57,7 @@ public void notEnumerated() throws Exception {
5657
public Object run(final Context cx) {
5758
final Scriptable scope = cx.initStandardObjects();
5859
final Object result = cx.evaluateString(scope, script, "test.js", 1, null);
59-
Assert.assertEquals("", result);
60+
assertEquals("", result);
6061
return null;
6162
}
6263
};
@@ -121,7 +122,7 @@ public Object run(final Context cx) {
121122
final Scriptable scope = cx.initStandardObjects();
122123

123124
final Object result = cx.evaluateString(scope, script, "test.js", 1, null);
124-
Assert.assertEquals("2-2", result);
125+
assertEquals("2-2", result);
125126
return null;
126127
}
127128
};
@@ -155,7 +156,7 @@ public Object run(final Context cx) {
155156
final Scriptable scope = cx.initStandardObjects();
156157

157158
final Object result = cx.evaluateString(scope, script, "test.js", 1, null);
158-
Assert.assertEquals("2-hello-2", result);
159+
assertEquals("2-hello-2", result);
159160
return null;
160161
}
161162
};
@@ -185,7 +186,7 @@ public Object run(final Context cx) {
185186
final Scriptable scope = cx.initStandardObjects();
186187

187188
final Object result = cx.evaluateString(scope, script, "test.js", 1, null);
188-
Assert.assertEquals("true, true", result);
189+
assertEquals("true, true", result);
189190
return null;
190191
}
191192
};

src/test/java/net/sourceforge/htmlunit/FunctionNullSetTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package net.sourceforge.htmlunit;
22

3+
import static org.junit.Assert.assertEquals;
4+
35
import java.lang.reflect.Method;
46

5-
import org.junit.Assert;
67
import org.junit.Test;
78
import org.mozilla.javascript.Context;
89
import org.mozilla.javascript.ContextAction;
@@ -63,7 +64,7 @@ public Object run(final Context cx) {
6364

6465
realFunction_.call(cx, jsObj, jsObj, new Object[0]);
6566

66-
Assert.assertEquals(expectedNull, jsObj.onclick_ == null);
67+
assertEquals(expectedNull, jsObj.onclick_ == null);
6768
}
6869
catch (final Exception e) {
6970
throw new RuntimeException(e);

src/test/java/net/sourceforge/htmlunit/FunctionTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.sourceforge.htmlunit;
22

3-
import org.junit.Assert;
3+
import static org.junit.Assert.assertEquals;
4+
45
import org.junit.Test;
56
import org.mozilla.javascript.Context;
67
import org.mozilla.javascript.ContextAction;
@@ -29,7 +30,7 @@ private static void assertEvaluates(final Object expected, final String source)
2930
public Object run(Context cx) {
3031
final Scriptable scope = cx.initStandardObjects();
3132
final Object rep = cx.evaluateString(scope, source, "test.js", 0, null);
32-
Assert.assertEquals(expected, rep);
33+
assertEquals(expected, rep);
3334
return null;
3435
}
3536
};

0 commit comments

Comments
 (0)