/*
 * Copyright 2016 Yi-Kun Yang.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.allnix.ext;

import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.testng.Assert;
import org.testng.annotations.Test;

/**
 *
 * @author Yi-Kun Yang &gt;ykyang@gmail.com&lt;
 */
public class TestJackson {
  @Test
  public void testObjectNode() {
    ObjectNode node = new ObjectNode(JsonNodeFactory.instance);
    
    String value = "12345";
    node.put("id", value);
    
    Assert.assertEquals(node.get("id").asText(), value);
  }
}

@@ -615,16 +615,116 @@
 x.ext;%0A%0A
+import com.fasterxml.jackson.databind.JsonNode;%0Aimport com.fasterxml.jackson.databind.ObjectMapper;%0A
 import c
@@ -826,24 +826,72 @@
 ObjectNode;%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A
 import org.t
@@ -904,16 +904,59 @@
 Assert;%0A
+import org.testng.annotations.BeforeClass;%0A
 import o
@@ -1070,16 +1070,154 @@
 ckson %7B%0A
+  private ObjectMapper mapper;%0A%0A  @BeforeClass(alwaysRun = true)%0A  public void beforeClass() %7B%0A    mapper = new ObjectMapper();%0A  %7D%0A  %0A  %0A
   @Test%0A
@@ -1309,29 +1309,33 @@
 .instance);%0A
+%0A
     
-%0A
+%7B%0A  
     String v
@@ -1354,16 +1354,18 @@
 5%22;%0A    
+  
 node.put
@@ -1383,19 +1383,16 @@
 e);%0A    
-%0A  
   Assert
@@ -1438,14 +1438,367 @@
 value);%0A
+    %7D%0A  %7D%0A  %0A  /**%0A   * Show how to use valueToTree method%0A   */%0A  @Test%0A  public void testValuetoTree() %7B%0A    Map%3CString,Object%3E value = new HashMap%3C%3E();%0A    String uuid = %22300a9aa6-4f9d-4286-b7be-f23a20374a7d%22;%0A    value.put(%22id%22, uuid);%0A    %0A    JsonNode node = mapper.valueToTree(value);%0A    %0A    Assert.assertEquals(node.get(%22id%22).asText(), uuid);%0A
   %7D%0A%7D%0A

Add Jackson test