HHH-8061 - Fixing EnumSet test on Oracle

This commit is contained in:
Lukasz Antoniak 2013-03-13 20:43:14 +01:00
parent 2c5098b9c6
commit 11287c2e02
2 changed files with 8 additions and 3 deletions

View File

@ -115,11 +115,15 @@ public class EnumSet extends BaseEnversJPAFunctionalTestCase {
@TestForIssue( jiraKey = "HHH-7780" )
public void testEnumRepresentation() {
EntityManager entityManager = getEntityManager();
List<Object[]> enums1 = entityManager.createNativeQuery( "SELECT enums1 FROM EnumSetEntity_enums1_AUD ORDER BY rev ASC" ).getResultList();
List<Object[]> enums2 = entityManager.createNativeQuery( "SELECT enums2 FROM EnumSetEntity_enums2_AUD ORDER BY rev ASC" ).getResultList();
List<Object> enums1 = entityManager.createNativeQuery( "SELECT enums1 FROM EnumSetEntity_enums1_AUD ORDER BY rev ASC" ).getResultList();
List<Object> enums2 = entityManager.createNativeQuery( "SELECT enums2 FROM EnumSetEntity_enums2_AUD ORDER BY rev ASC" ).getResultList();
entityManager.close();
Assert.assertEquals( Arrays.asList( "X", "Y", "X" ), enums1 );
Assert.assertEquals( Arrays.asList( 0 ), enums2 );
Assert.assertEquals( 1, enums2.size() );
Object enum2 = enums2.get( 0 );
// Compare the Strings to account for, as an example, Oracle returning a BigDecimal instead of an int.
Assert.assertEquals( "0", enum2.toString() );
}
}

View File

@ -43,6 +43,7 @@ public class EnumTypeTest extends BaseEnversJPAFunctionalTestCase {
Assert.assertNotNull( values );
Assert.assertEquals( 1, values.size() );
Object[] results = values.get( 0 );
Assert.assertEquals( 2, results.length );
Assert.assertEquals( "X", results[0] );
// Compare the Strings to account for, as an example, Oracle
// returning a BigDecimal instead of an int.