Hi this is my first post here . I am a newbie with UnitTesting .
Please suggest me
I am using Unit Test to write Test Cases aganist Hibernate implementation and i am using HSQLDB
Code:
protected void setUp() throws Exception {
Configuration configuration =
new Configuration();
configuration.setProperty(
Environment.DRIVER,
"org.hsqldb.jdbcDriver");
configuration.setProperty(
Environment.URL,
"jdbc:hsqldb:mem:ProductDAOTest");
configuration.setProperty(
Environment.USER, "sa");
configuration.setProperty(
Environment.DIALECT,
HSQLDialect.class.getName());
configuration.setProperty(
Environment.SHOW_SQL, "true");
}
Code:
public void testSave()
{
SessionFactory sessionFactory =
configuration.buildSessionFactory();
}
I am not using Spring Framework
Please tell me will it be a good approach if i get access to the SessionFactory and session inside my testMethod??