@Test public void stringDiscriminatorWithoutDiscriminatorValueAnnotationSet_DiscriminatorValuesGetSetToItsDefaults() throws SQLException { EntityConfig[] entities = entityConfigurationReader.readConfiguration( StringDiscriminatorWithoutDiscriminatorValueAnnotationSetBaseClass.class, StringDiscriminatorWithoutDiscriminatorValueAnnotationSetSubClass1.class, StringDiscriminatorWithoutDiscriminatorValueAnnotationSetSubClass2.class); InheritanceEntityConfig baseClassConfig = (InheritanceEntityConfig) entities[0]; Assert.assertEquals( StringDiscriminatorWithoutDiscriminatorValueAnnotationSetBaseClass.class .getSimpleName() .toUpperCase(), baseClassConfig.getDiscriminatorValueForEntity(baseClassConfig)); EntityConfig subClass1Config = entities[1]; Assert.assertEquals( StringDiscriminatorWithoutDiscriminatorValueAnnotationSetSubClass1.class .getSimpleName() .toUpperCase(), baseClassConfig.getDiscriminatorValueForEntity(subClass1Config)); EntityConfig subClass2Config = entities[2]; Assert.assertEquals( StringDiscriminatorWithoutDiscriminatorValueAnnotationSetSubClass2.class .getSimpleName() .toUpperCase(), baseClassConfig.getDiscriminatorValueForEntity(subClass2Config)); }
@Test public void charDiscriminatorWithoutDiscriminatorValueAnnotationSet_DiscriminatorValuesGetSetToItsDefaults() throws SQLException { EntityConfig[] entities = entityConfigurationReader.readConfiguration( CharDiscriminatorWithoutDiscriminatorValueAnnotationSetBaseClass.class, CharDiscriminatorWithoutDiscriminatorValueAnnotationSetSubClass1.class, CharDiscriminatorWithoutDiscriminatorValueAnnotationSetSubClass2.class); InheritanceEntityConfig baseClassConfig = (InheritanceEntityConfig) entities[0]; Assert.assertEquals("A", baseClassConfig.getDiscriminatorValueForEntity(baseClassConfig)); EntityConfig subClass1Config = entities[1]; Assert.assertEquals("B", baseClassConfig.getDiscriminatorValueForEntity(subClass1Config)); EntityConfig subClass2Config = entities[2]; Assert.assertEquals("C", baseClassConfig.getDiscriminatorValueForEntity(subClass2Config)); }