@Test @Ignore @DataSet("TypeBeforeUpdateDataSet.xml") @ExpectedDataSet("TypeAfterUpdateDataSet.xml") public void testUpdateType() throws Exception { // Get Hibernate Session Session session = factory.getCurrentSession(); // Load and modify Type result = (Type) session.get(Type.class, TypeTestUtils.getDefaultIdentity()); result.setType1(Integer.valueOf(2)); result.setType10(new Date(3722000L)); result.setType12(new Date(1233532800000L)); result.setType13(new Date(1233540122000L)); result.setType14(new byte[] {116, 101, 115, 116, 50}); result.setType16("t"); result.setType17("t"); result.setType18(new byte[] {116, 101, 115, 116, 50}); result.setType19("t"); result.setType2(Boolean.FALSE); result.setType20("t"); result.setType3(Byte.valueOf("2")); result.setType4(Short.valueOf((short) 2)); result.setType5(Long.valueOf(2L)); result.setType7(new BigDecimal("20000000.02")); result.setType8(Double.valueOf(20000000000000000.2)); result.setType9(Float.valueOf(2000000.2F)); // update session.save(result); }
@Test @DataSet("TypeFindDataSet.xml") public void testFindTypeByIdentity() throws Exception { // Get Hibernate Session Session session = factory.getCurrentSession(); // Get object from Hibernate Type result = (Type) session.get(Type.class, TypeTestUtils.getDefaultIdentity()); // Test properties Assert.assertNotNull(result); Assert.assertEquals(Integer.valueOf(1), result.getType1()); Assert.assertEquals(new Date(61000L), result.getType10()); Assert.assertEquals(new Date(1230768000000L), result.getType12()); Assert.assertEquals(new Date(1230771661000L), result.getType13()); Assert.assertArrayEquals(new byte[] {116, 101, 115, 116, 49}, result.getType14()); Assert.assertEquals("s", result.getType16()); Assert.assertEquals("s", result.getType17()); Assert.assertArrayEquals(new byte[] {116, 101, 115, 116, 49}, result.getType18()); Assert.assertEquals("s", result.getType19()); Assert.assertEquals(Boolean.TRUE, result.getType2()); Assert.assertEquals("s", result.getType20()); Assert.assertEquals(Byte.valueOf("1"), result.getType3()); Assert.assertEquals(Short.valueOf((short) 1), result.getType4()); Assert.assertEquals(Long.valueOf(1L), result.getType5()); Assert.assertEquals(new BigDecimal("10000000.01"), result.getType7()); Assert.assertEquals(Double.valueOf(10000000000000000.1), result.getType8()); Assert.assertEquals(Float.valueOf(1000000.1F), result.getType9()); }
@Test @DataSet("TypeBeforeDeleteDataSet.xml") @ExpectedDataSet("TypeAfterDeleteDataSet.xml") public void testRemoveType() throws Exception { // Get Hibernate Session Session session = factory.getCurrentSession(); // delete Type result = (Type) session.get(Type.class, TypeTestUtils.getDefaultIdentity()); session.delete(result); }