@Test
  public void testJsonListOfHashes() throws Exception {
    List<Map<String, String>> data = new LinkedList<Map<String, String>>();
    Map<String, String> contentSet1 = new HashMap<String, String>();
    contentSet1.put("name", "cs1");
    contentSet1.put("url", "url");

    Map<String, String> contentSet2 = new HashMap<String, String>();
    contentSet2.put("name", "cs2");
    contentSet2.put("url", "url2");

    data.add(contentSet1);
    data.add(contentSet2);

    ObjectMapper mapper = new ObjectMapper();
    String jsonData = mapper.writeValueAsString(data);

    Product prod = new Product("cptest-label", "My Product", owner);
    ProductAttribute a = new ProductAttribute("content_sets", jsonData);
    prod.addAttribute(a);
    productCurator.create(prod);
    attributeCurator.create(a);

    Product lookedUp = productCurator.find(prod.getUuid());
    assertEquals(jsonData, lookedUp.getAttribute("content_sets").getValue());

    data =
        mapper.readValue(
            lookedUp.getAttribute("content_sets").getValue(),
            new TypeReference<List<Map<String, String>>>() {});
    Map<String, String> cs1 = data.get(0);
    assertEquals("cs1", cs1.get("name"));

    Map<String, String> cs2 = data.get(1);
    assertEquals("cs2", cs2.get("name"));
  }
  @Test
  public void testWithSimpleJsonAttribute() throws Exception {
    Map<String, String> data = new HashMap<String, String>();
    data.put("a", "1");
    data.put("b", "2");
    ObjectMapper mapper = new ObjectMapper();
    String jsonData = mapper.writeValueAsString(data);

    Product prod = new Product("cptest-label", "My Product", owner);
    ProductAttribute a = new ProductAttribute("content_sets", jsonData);
    prod.addAttribute(a);
    productCurator.create(prod);
    attributeCurator.create(a);

    Product lookedUp = productCurator.find(prod.getUuid());
    assertEquals(jsonData, lookedUp.getAttribute("content_sets").getValue());

    data =
        mapper.readValue(
            lookedUp.getAttribute("content_sets").getValue(),
            new TypeReference<Map<String, String>>() {});
    assertEquals("1", data.get("a"));
    assertEquals("2", data.get("b"));
  }