@Test public void testDynamicHeaders() { Config panel = configMap.get("dynamicHeaders"); GenericEntity meta = new GenericEntity(); meta.put("id", "Funky ID"); GenericEntity name = new GenericEntity(); name.put("first", "AAA"); meta.put("name", name); GenericEntity entity = new GenericEntity(); entity.put("meta", meta); Config.Item[] items = customizationAssemblyFactory.getUpdatedDynamicHeaderTemplate(panel, entity); Assert.assertEquals("AAA", items[0].getName()); Assert.assertEquals("Funky ID", items[1].getName()); }
@BeforeClass public static void setupAll() { Gson gson = new GsonBuilder().create(); configMap = new HashMap<String, Config>(); configMap.put("studentProfile", gson.fromJson(DEFAULT_LAYOUT_JSON, Config.class)); configMap.put("panel", gson.fromJson(DEFAULT_PANEL_JSON, Config.class)); configMap.put("panel1", gson.fromJson(DEFAULT_PANEL1_JSON, Config.class)); configMap.put("deep", gson.fromJson(DEFAULT_LAYOUT_TOO_DEEP_JSON, Config.class)); configMap.put("panelException", gson.fromJson(DEFAULT_PANEL_EXCEPTION_JSON, Config.class)); configMap.put("dynamicHeaders", gson.fromJson(PANEL_WITH_DYNAMIC_HEADERS, Config.class)); configMap.put("test", gson.fromJson(CACHE_TEST_JSON, Config.class)); configMap.put("listOfStudents", gson.fromJson(LIST_OF_STUDENTS_JSON, Config.class)); simpleMaleStudentEntity = new GenericEntity(); simpleMaleStudentEntity.put("id", "1"); simpleMaleStudentEntity.put("gender", "male"); simpleMaleStudentEntity.put("gradeNumeric", 5); simpleFemaleStudentEntity = new GenericEntity(); simpleFemaleStudentEntity.put("id", "2"); simpleFemaleStudentEntity.put("gender", "female"); simpleFemaleStudentEntity.put("gradeNumeric", 7); simpleNoGenderInfoStudentEntity = new GenericEntity(); simpleNoGenderInfoStudentEntity.put("id", "3"); simpleNoGenderInfoStudentEntity.put("gradeNumeric", 7); simpleCacheData = new GenericEntity(); simpleCacheData.put("id", "testEntityKey"); simpleCacheData.put("data", "testData1"); sampleEntityMap = new HashMap<String, GenericEntity>(); sampleEntityMap.put(simpleMaleStudentEntity.getString("id"), simpleMaleStudentEntity); sampleEntityMap.put(simpleFemaleStudentEntity.getString("id"), simpleFemaleStudentEntity); sampleEntityMap.put( simpleNoGenderInfoStudentEntity.getString("id"), simpleNoGenderInfoStudentEntity); sampleEntityMap.put(simpleCacheData.getString("id"), simpleCacheData); sampleEntityMap.put("section", JsonConverter.fromJson(SECTION_ENTITY, GenericEntity.class)); sampleEntityMap.put( "listOfStudents", JsonConverter.fromJson(LIST_OF_STUDENTS_ENTITY, GenericEntity.class)); }