Skip to content

Commit

Permalink
Revert custom serialisation of UnhandledAlertException
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
shs96c committed Oct 13, 2016
1 parent 00d0d20 commit b1edbb1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 27 deletions.
11 changes: 0 additions & 11 deletions java/client/src/org/openqa/selenium/UnhandledAlertException.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

package org.openqa.selenium;

import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;

public class UnhandledAlertException extends WebDriverException {

private final String alertText;
Expand All @@ -39,12 +36,4 @@ public UnhandledAlertException(String message, String alertText) {
public String getAlertText() {
return alertText;
}

public JsonObject toJson() {
JsonObject text = new JsonObject();
text.add("text", new JsonPrimitive(alertText));
JsonObject alert = new JsonObject();
alert.add("alert", text);
return alert;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@

package org.openqa.selenium.remote;

import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
Expand All @@ -32,7 +41,6 @@
import org.openqa.selenium.Cookie;
import org.openqa.selenium.Platform;
import org.openqa.selenium.Proxy;
import org.openqa.selenium.UnhandledAlertException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.logging.LogEntries;
import org.openqa.selenium.logging.LogEntry;
Expand All @@ -49,15 +57,6 @@
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;

import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;


@RunWith(JUnit4.class)
public class BeanToJsonConverterTest {
Expand Down Expand Up @@ -328,12 +327,6 @@ public void testShouldBeAbleToConvertAWebDriverException() {
verifyStackTraceInJson(raw, stackTrace);
}

@Test
public void testShouldConverUnhandledAlertException() {
RuntimeException clientError = new UnhandledAlertException("unhandled alert", "cheese!");
assertEquals("{\"alert\":{\"text\":\"cheese!\"}}", new BeanToJsonConverter().convert(clientError));
}

@Test
public void testShouldConvertDatesToMillisecondsInUtcTime() {
String jsonStr = new BeanToJsonConverter().convert(new Date(0));
Expand Down

0 comments on commit b1edbb1

Please sign in to comment.