Skip to content

Commit b1edbb1

Browse files
committed
Revert custom serialisation of UnhandledAlertException
I'm not sure why this was added, and the commit it landed in doesn't explain why the change was made. Reverting, since it appears to be unnecessary.
1 parent 00d0d20 commit b1edbb1

File tree

2 files changed

+9
-27
lines changed

2 files changed

+9
-27
lines changed

java/client/src/org/openqa/selenium/UnhandledAlertException.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818
package org.openqa.selenium;
1919

20-
import com.google.gson.JsonObject;
21-
import com.google.gson.JsonPrimitive;
22-
2320
public class UnhandledAlertException extends WebDriverException {
2421

2522
private final String alertText;
@@ -39,12 +36,4 @@ public UnhandledAlertException(String message, String alertText) {
3936
public String getAlertText() {
4037
return alertText;
4138
}
42-
43-
public JsonObject toJson() {
44-
JsonObject text = new JsonObject();
45-
text.add("text", new JsonPrimitive(alertText));
46-
JsonObject alert = new JsonObject();
47-
alert.add("alert", text);
48-
return alert;
49-
}
5039
}

java/client/test/org/openqa/selenium/remote/BeanToJsonConverterTest.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@
1717

1818
package org.openqa.selenium.remote;
1919

20+
import static org.hamcrest.Matchers.containsString;
21+
import static org.hamcrest.Matchers.is;
22+
import static org.hamcrest.Matchers.not;
23+
import static org.junit.Assert.assertEquals;
24+
import static org.junit.Assert.assertFalse;
25+
import static org.junit.Assert.assertThat;
26+
import static org.junit.Assert.assertTrue;
27+
import static org.junit.Assert.fail;
28+
2029
import com.google.common.collect.ImmutableList;
2130
import com.google.common.collect.ImmutableMap;
2231
import com.google.common.collect.Lists;
@@ -32,7 +41,6 @@
3241
import org.openqa.selenium.Cookie;
3342
import org.openqa.selenium.Platform;
3443
import org.openqa.selenium.Proxy;
35-
import org.openqa.selenium.UnhandledAlertException;
3644
import org.openqa.selenium.WebDriverException;
3745
import org.openqa.selenium.logging.LogEntries;
3846
import org.openqa.selenium.logging.LogEntry;
@@ -49,15 +57,6 @@
4957
import java.util.concurrent.TimeUnit;
5058
import java.util.logging.Level;
5159

52-
import static org.hamcrest.Matchers.containsString;
53-
import static org.hamcrest.Matchers.is;
54-
import static org.hamcrest.Matchers.not;
55-
import static org.junit.Assert.assertEquals;
56-
import static org.junit.Assert.assertFalse;
57-
import static org.junit.Assert.assertThat;
58-
import static org.junit.Assert.assertTrue;
59-
import static org.junit.Assert.fail;
60-
6160

6261
@RunWith(JUnit4.class)
6362
public class BeanToJsonConverterTest {
@@ -328,12 +327,6 @@ public void testShouldBeAbleToConvertAWebDriverException() {
328327
verifyStackTraceInJson(raw, stackTrace);
329328
}
330329

331-
@Test
332-
public void testShouldConverUnhandledAlertException() {
333-
RuntimeException clientError = new UnhandledAlertException("unhandled alert", "cheese!");
334-
assertEquals("{\"alert\":{\"text\":\"cheese!\"}}", new BeanToJsonConverter().convert(clientError));
335-
}
336-
337330
@Test
338331
public void testShouldConvertDatesToMillisecondsInUtcTime() {
339332
String jsonStr = new BeanToJsonConverter().convert(new Date(0));

0 commit comments

Comments
 (0)