return new DummyPersistenceService();
}
};
// test new instance of TestEntity is created when objectId is not set.
IEntity initEntity = backingBean.initEntity();
Assert.assertNotNull(initEntity);
Assert.assertTrue(initEntity instanceof TestEntity);
Assert.assertNull(initEntity.getId());
backingBean.setObjectId(22L);
//
initEntity = backingBean.initEntity();
Assert.assertNotNull(initEntity);
Assert.assertTrue(initEntity instanceof TestEntity);
Assert.assertEquals(Long.valueOf(22L), initEntity.getId());
// not exist
backingBean.setObjectId(23L);
initEntity = backingBean.initEntity();
Assert.assertNull(initEntity);