use of org.jboss.tools.hibernate.runtime.spi.IType in project jbosstools-hibernate by jbosstools.
the class QueryFacadeTest method testSetParameter.
@Test
public void testSetParameter() {
Type typeProxy = (Type) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Type.class }, new TypeInvocationHandler());
IType typeFacade = FACADE_FACTORY.createType(typeProxy);
Object object = new Object();
query.setParameter(Integer.MAX_VALUE, object, typeFacade);
Assert.assertEquals("setParameter", methodName);
Assert.assertArrayEquals(new Object[] { Integer.MAX_VALUE, object, typeProxy }, arguments);
methodName = null;
arguments = null;
query.setParameter("foobar", object, typeFacade);
Assert.assertEquals("setParameter", methodName);
Assert.assertArrayEquals(new Object[] { "foobar", object, typeProxy }, arguments);
}
use of org.jboss.tools.hibernate.runtime.spi.IType in project jbosstools-hibernate by jbosstools.
the class QueryFacadeTest method testSetParameterList.
@Test
public void testSetParameterList() {
Type typeProxy = (Type) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Type.class }, new TypeInvocationHandler());
IType typeFacade = FACADE_FACTORY.createType(typeProxy);
List<Object> dummyList = Collections.emptyList();
query.setParameterList("foobar", dummyList, typeFacade);
Assert.assertEquals("setParameterList", methodName);
Assert.assertArrayEquals(new Object[] { "foobar", dummyList, typeProxy }, arguments);
}
use of org.jboss.tools.hibernate.runtime.spi.IType in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateType.
@Test
public void testCreateType() {
Type type = (Type) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Type.class }, new TestInvocationHandler());
IType facade = facadeFactory.createType(type);
Assert.assertSame(type, ((IFacade) facade).getTarget());
}
use of org.jboss.tools.hibernate.runtime.spi.IType in project jbosstools-hibernate by jbosstools.
the class TypeFacadeTest method testGetPrimitiveClass.
@Test
public void testGetPrimitiveClass() {
IType typeFacade = null;
ClassType classType = new ClassType();
typeFacade = FACADE_FACTORY.createType(classType);
Assert.assertNull(typeFacade.getPrimitiveClass());
IntegerType integerType = new IntegerType();
typeFacade = FACADE_FACTORY.createType(integerType);
Assert.assertEquals(int.class, typeFacade.getPrimitiveClass());
}
use of org.jboss.tools.hibernate.runtime.spi.IType in project jbosstools-hibernate by jbosstools.
the class TypeFacadeTest method testIsInstanceOfPrimitiveType.
@Test
public void testIsInstanceOfPrimitiveType() {
IType typeFacade = null;
ClassType classType = new ClassType();
typeFacade = FACADE_FACTORY.createType(classType);
Assert.assertFalse(typeFacade.isInstanceOfPrimitiveType());
StringType stringType = new StringType();
typeFacade = FACADE_FACTORY.createType(stringType);
Assert.assertFalse(typeFacade.isInstanceOfPrimitiveType());
IntegerType integerType = new IntegerType();
typeFacade = FACADE_FACTORY.createType(integerType);
Assert.assertTrue(typeFacade.isInstanceOfPrimitiveType());
}
Aggregations