HHH-8029 Improve SimpleNationalizedTest

This commit is contained in:
Brett Meyer 2013-02-22 13:55:41 -05:00
parent 2e18376fba
commit a9cc4ab67c
1 changed files with 36 additions and 9 deletions

View File

@ -23,28 +23,28 @@
*/ */
package org.hibernate.test.nationalized; package org.hibernate.test.nationalized;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import java.sql.NClob;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Lob; import javax.persistence.Lob;
import java.sql.NClob;
import org.hibernate.annotations.Nationalized; import org.hibernate.annotations.Nationalized;
import org.hibernate.annotations.Type;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property; import org.hibernate.mapping.Property;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.hibernate.type.CharacterNCharType;
import org.hibernate.type.MaterializedNClobType; import org.hibernate.type.MaterializedNClobType;
import org.hibernate.type.NClobType; import org.hibernate.type.NClobType;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.NTextType;
import org.hibernate.type.StringNVarcharType; import org.hibernate.type.StringNVarcharType;
import org.junit.Test; import org.junit.Test;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@ -54,14 +54,26 @@ public class SimpleNationalizedTest extends BaseUnitTestCase {
public static class NationalizedEntity { public static class NationalizedEntity {
@Id @Id
private Integer id; private Integer id;
@Nationalized @Nationalized
private String nvarcharAtt; private String nvarcharAtt;
@Lob @Lob
@Nationalized @Nationalized
private String materializedNclobAtt; private String materializedNclobAtt;
@Lob @Lob
@Nationalized @Nationalized
private NClob nclobAtt; private NClob nclobAtt;
@Nationalized
private Character ncharacterAtt;
@Nationalized
private Character[] ncharArrAtt;
@Type(type = "ntext")
private String nlongvarcharcharAtt;
} }
@Test @Test
@ -86,5 +98,20 @@ public class SimpleNationalizedTest extends BaseUnitTestCase {
Property prop = pc.getProperty( "nclobAtt" ); Property prop = pc.getProperty( "nclobAtt" );
assertSame( NClobType.INSTANCE, prop.getType() ); assertSame( NClobType.INSTANCE, prop.getType() );
} }
{
Property prop = pc.getProperty( "nlongvarcharcharAtt" );
assertSame( NTextType.INSTANCE, prop.getType() );
}
{
Property prop = pc.getProperty( "ncharArrAtt" );
assertSame( StringNVarcharType.INSTANCE, prop.getType() );
}
{
Property prop = pc.getProperty( "ncharacterAtt" );
assertSame( CharacterNCharType.INSTANCE, prop.getType() );
}
} }
} }