Hi,
I have a stateless bean which executes some native SQL.
@PostConstruct
public void init()
{
try
{
connection = unmanagedDataSource.getConnection();
// create some tables
}
catch (SQLException e)
{
throw new RuntimeException(e);
}
}
@PreDestroy
public void destroy()
{
try
{
// drop some tables
connection.close();
}
catch (SQLException e)
{
throw new RuntimeException(e);
}
}
public void executeNativeSQL()
{
// some native sql
}
In my unit test the @PreDestroy annotated method is never invoked.
Is this the expected behaviour?
So in a unit test i have to call the destroy method manually from the
unit test?