/** Test getting a component for a test */
  @Test
  public void testDataComponent() {
    ApplicationContext goodContext =
        new AnnotationConfigApplicationContext(
            new Class<?>[] {ContextConfigurationWithGoodMananger.class});
    customizationAssemblyFactory.setApplicationContext(goodContext);
    // test good one
    Assert.assertEquals(
        simpleMaleStudentEntity,
        customizationAssemblyFactory.getDataComponentForTest(
            "panel", "1", configMap.get("panel").getData()));
    // test an entity mapping that throws an exception
    Assert.assertNull(
        customizationAssemblyFactory.getDataComponentForTest(
            "panelException", "1", configMap.get("panelException").getData()));

    // test non-existent one
    Config.Data fakeDataConfig = new Config.Data("fake", "fake", false, null);
    Assert.assertNotNull(fakeDataConfig);
    try {
      customizationAssemblyFactory.getDataComponentForTest("panel", "1", fakeDataConfig);
      Assert.fail("Must not be able to find fake entity reference and throw an exception");
    } catch (DashboardException de) {
      Assert.assertEquals(
          "No entity mapping references found for " + fakeDataConfig.getEntityRef() + ". Fix!!!",
          de.getMessage());
    }
  }
  /** Test not to allow bad signature entity references */
  @Test
  public void testBadEntityReference() {
    ApplicationContext badContext =
        new AnnotationConfigApplicationContext(
            new Class<?>[] {ContextConfigurationWithBadEntityRefSignature.class});
    try {
      customizationAssemblyFactory.setApplicationContext(badContext);
      Assert.fail("Should not allow testBad - bad signature");
    } catch (DashboardException de) {
      Assert.assertEquals(
          "Wrong signature for the method for testBad. Expected is "
              + Arrays.asList(
                  CustomizationAssemblyFactoryImpl.ENTITY_REFERENCE_METHOD_EXPECTED_SIGNATURE)
              + "!!!",
          de.getMessage());
    }

    badContext =
        new AnnotationConfigApplicationContext(
            new Class<?>[] {ContextConfigurationWithDuplicates.class});
    try {
      customizationAssemblyFactory.setApplicationContext(badContext);
      Assert.fail("Should not allow testBad - duplicate entity reference");
    } catch (DashboardException de) {
      Assert.assertEquals(
          "Duplicate entity mapping references found for test. Fix!!!", de.getMessage());
    }
  }