@Test
public void testToJson() {

  DateTime before = new DateTime(2015, 03, 01, 00, 46, 17, 0, DateTimeZone.UTC);
  Policy policy = Policy.mkSimplePolicy("http://mh-allinone/", before);
  assertEquals("{\"Statement\":{\"Condition\":{\"DateLessThan\":" + before.getMillis()
          + "},\"Resource\":\"http:\\/\\/mh-allinone\\/\"}}", PolicyUtils.toJson(policy).toJSONString());
  // With optional parameters
  policy = Policy.mkPolicyValidFromWithIP("http://mh-allinone/", before, new DateTime(2015, 02, 28, 00, 46, 19, 0,
          DateTimeZone.UTC), EXAMPLE_IP);
  assertEquals(
          "{\"Statement\":{\"Condition\":{\"DateGreaterThan\":1425084379000,\"DateLessThan\":1425170777000,\"IpAddress\":\"10.0.0.1\"},\"Resource\":\"http:\\/\\/mh-allinone\\/\"}}",
          PolicyUtils.toJson(policy).toJSONString());
}