@Test public void testEntityMarshall() throws Exception { Entity entity = Entity.builder() .content(sampleContent1()) .attribute( Attribute.builder("testId3") .value(StringExp.of("aaa")) .value(StringExp.of("bbbb")) .value(StringExp.of("cccc")) .build()) .attribute( Attribute.builder("testId4") .value(StringExp.of("zzzz")) .value(StringExp.of("aaaa")) .value(StringExp.of("cccc")) .build()) .build(); Category a = Category.builder() .category(Categories.SUBJECT_ACCESS) .entity( Entity.builder() .attribute(Attribute.builder("testId1").value(EntityExp.of(entity)).build()) .build()) .build(); JsonElement o = json.toJsonTree(a); Category b = json.fromJson(o, Category.class); assertEquals(a, b); }