/** Test conditional layout contains different number of items depending on entity */ @Test public void testConditionalLayout() { ModelAndViewConfig viewAndConfig = customizationAssemblyFactory.getModelAndViewConfig( "studentProfile", simpleMaleStudentEntity.get("id")); Assert.assertEquals(3, viewAndConfig.getConfig().size()); viewAndConfig = customizationAssemblyFactory.getModelAndViewConfig( "studentProfile", simpleFemaleStudentEntity.get("id")); Assert.assertEquals(1, viewAndConfig.getConfig().size()); }
/** Test not to allow infinite recursion */ @Test public void testConfigTooDeep() { try { customizationAssemblyFactory.getModelAndViewConfig("deep", simpleMaleStudentEntity.get("id")); Assert.fail("Should not allow deep config structures"); } catch (Throwable t) { Assert.assertEquals( "The items hierarchy is too deep - only allow 5 elements", t.getMessage()); } }