/** Test of fromJson method, of class Patch. */
  @Test
  public void testFromJson() throws Exception {
    String json =
        "[{\"op\":\"replace\",\"path\":\"name\",\"value\":\"Ged "
            + "corrigée\"},{\"op\":\"replace\",\"path\":\"versionning\",\"value\":\"false\"},{"
            + "\"op\":\"remove\",\"path\":\"xmlForm\",\"value\":\"\"}]";
    JsonPatch instance = new JsonPatch();
    instance.fromJson(json);
    assertThat(instance, is(notNullValue()));
    assertThat(instance.getOperations(), is(notNullValue()));
    assertThat(instance.getOperations(), hasSize(3));
    Operation operation = instance.getOperationByPath("name");
    assertThat(operation, is(notNullValue()));
    assertThat(operation.getOp(), is(Op.replace));
    assertThat(operation.getValue(), is("Ged corrigée"));
    assertThat(operation.getPath(), is("name"));

    operation = instance.getOperationByPath("versionning");
    assertThat(operation, is(notNullValue()));
    assertThat(operation.getOp(), is(Op.replace));
    assertThat(operation.getValue(), is("false"));
    assertThat(operation.getPath(), is("versionning"));

    operation = instance.getOperationByPath("xmlForm");
    assertThat(operation, is(notNullValue()));
    assertThat(operation.getOp(), is(Op.remove));
    assertThat(operation.getValue(), is(""));
    assertThat(operation.getPath(), is("xmlForm"));

    operation = instance.getOperationByPath("miguel");
    assertThat(operation, is(nullValue()));
  }
 /** Test of serialize an instance. */
 @Test
 public void testSerialize() throws Exception {
   String json =
       "[{\"op\":\"replace\",\"path\":\"name\",\"value\":\"Ged "
           + "corrigée\"},{\"op\":\"replace\",\"path\":\"versionning\",\"value\":\"false\"},{"
           + "\"op\":\"remove\",\"path\":\"xmlForm\",\"value\":\"\"}]";
   JsonPatch instance = new JsonPatch();
   instance.fromJson(json);
   assertThat(instance, is(notNullValue()));
   assertThat(instance.getOperations(), is(notNullValue()));
   assertThat(instance.getOperations(), hasSize(3));
   ByteArrayOutputStream buffer = new ByteArrayOutputStream(512);
   ObjectOutputStream out = new ObjectOutputStream(buffer);
   try {
     out.writeObject(instance);
   } finally {
     IOUtils.closeQuietly(out);
   }
 }