Search in sources :

Example 36 with ArrayType

use of org.hibernate.type.ArrayType in project jbosstools-hibernate by jbosstools.

the class TypeFacadeTest method testGetRole.

@Test
public void testGetRole() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertNull(typeFacade.getRole());
    ArrayType arrayType = new ArrayType(null, "foo", null, String.class);
    typeFacade = FACADE_FACTORY.createType(arrayType);
    Assert.assertEquals("foo", typeFacade.getRole());
}
Also used : ArrayType(org.hibernate.type.ArrayType) ClassType(org.hibernate.type.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 37 with ArrayType

use of org.hibernate.type.ArrayType in project jbosstools-hibernate by jbosstools.

the class TypeFacadeTest method testIsCollectionType.

@Test
public void testIsCollectionType() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertFalse(typeFacade.isCollectionType());
    ArrayType arrayType = new ArrayType(null, null, null, String.class);
    typeFacade = FACADE_FACTORY.createType(arrayType);
    Assert.assertTrue(typeFacade.isCollectionType());
}
Also used : ArrayType(org.hibernate.type.ArrayType) ClassType(org.hibernate.type.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 38 with ArrayType

use of org.hibernate.type.ArrayType in project jbosstools-hibernate by jbosstools.

the class TypeFacadeTest method testGetName.

@Test
public void testGetName() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertEquals("class", typeFacade.getName());
    ArrayType arrayType = new ArrayType(null, "foo", "bar", String.class);
    typeFacade = FACADE_FACTORY.createType(arrayType);
    Assert.assertEquals("[Ljava.lang.String;(foo)", typeFacade.getName());
}
Also used : ArrayType(org.hibernate.type.ArrayType) ClassType(org.hibernate.type.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 39 with ArrayType

use of org.hibernate.type.ArrayType in project jbosstools-hibernate by jbosstools.

the class TypeFacadeTest method testFromStringValue.

@Test
public void testFromStringValue() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertEquals(TypeFacadeTest.class, typeFacade.fromStringValue(TypeFacadeTest.class.getName()));
    ArrayType arrayType = new ArrayType("foo", "bar", String.class, false);
    typeFacade = FACADE_FACTORY.createType(arrayType);
    Assert.assertNull(typeFacade.fromStringValue("just a random string"));
}
Also used : ArrayType(org.hibernate.type.ArrayType) ClassType(org.hibernate.type.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 40 with ArrayType

use of org.hibernate.type.ArrayType in project jbosstools-hibernate by jbosstools.

the class TypeFacadeTest method testFromStringValue.

@Test
public void testFromStringValue() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertEquals(TypeFacadeTest.class, typeFacade.fromStringValue(TypeFacadeTest.class.getName()));
    ArrayType arrayType = new ArrayType(null, "foo", "bar", String.class, false);
    typeFacade = FACADE_FACTORY.createType(arrayType);
    Assert.assertNull(typeFacade.fromStringValue("just a random string"));
}
Also used : ArrayType(org.hibernate.type.ArrayType) ClassType(org.hibernate.type.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Aggregations

ArrayType (org.hibernate.type.ArrayType)56 ClassType (org.hibernate.type.ClassType)56 IType (org.jboss.tools.hibernate.runtime.spi.IType)56 Test (org.junit.Test)56 BagType (org.hibernate.type.BagType)8