Skip to content

Commit

Permalink
Moving a test from gson to our json
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Sep 10, 2018
1 parent 4c39e9d commit a4d8dd8
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.openqa.selenium.remote.Dialect.W3C;

import com.google.gson.Gson;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.WrappedWebElement;
import org.openqa.selenium.interactions.PointerInput.Kind;
import org.openqa.selenium.interactions.PointerInput.Origin;
import org.openqa.selenium.json.Json;
import org.openqa.selenium.json.PropertySetting;
import org.openqa.selenium.remote.RemoteWebElement;

import java.time.Duration;
import java.util.List;
import java.util.Map;

/**
* Unit test for PointerInputs.
*/
Expand All @@ -49,7 +50,10 @@ public void encodesWrappedElementInMoveOrigin() {
Sequence sequence = new Sequence(move.getSource(), 0).addAction(move);

String rawJson = new Json().toJson(sequence);
ActionSequenceJson json = new Gson().fromJson(rawJson, ActionSequenceJson.class);
ActionSequenceJson json = new Json().toType(
rawJson,
ActionSequenceJson.class,
PropertySetting.BY_FIELD);

assertThat(json.actions).hasSize(1);
ActionJson firstAction = json.actions.get(0);
Expand Down

0 comments on commit a4d8dd8

Please sign in to comment.