@Test
public void jsonToSchemaWithKeysAndSchemaKeys() throws Exception
{

  final Map<String, String> expectedSchemaKeys = Maps.newHashMap();
  expectedSchemaKeys.put("publisher", "google");
  expectedSchemaKeys.put("advertiser", "microsoft");
  expectedSchemaKeys.put("location", "CA");
  final Map<String, String> expectedKeys = Maps.newHashMap();
  expectedKeys.put("publisher", "google");
  expectedKeys.put("advertiser", "microsoft");
  final String id = "12345";
  final String schemaQueryJSON = "{" +
      "\"id\":\"" + id + "\"," +
      "\"type\":\"" + SchemaQuery.TYPE + "\"," +
      "\"context\":{" +
      "\"schemaKeys\":" +
      "{\"publisher\":\"google\",\"advertiser\":\"microsoft\",\"location\":\"CA\"}," +
      "\"keys\":{\"publisher\":\"google\",\"advertiser\":\"microsoft\"}" +
      "}}";
  @SuppressWarnings("unchecked")
  MessageDeserializerFactory qb = new MessageDeserializerFactory(SchemaQuery.class);
  SchemaQuery schemaQuery = (SchemaQuery)qb.deserialize(schemaQueryJSON);
  Assert.assertEquals("Id's must match", id, schemaQuery.getId());
  Assert.assertEquals("Types must match", SchemaQuery.TYPE, schemaQuery.getType());
  Assert.assertEquals("Schema keys must match", expectedSchemaKeys, schemaQuery.getSchemaKeys());
  Assert.assertEquals("Expected keys must match", expectedKeys, schemaQuery.getContextKeys());
}