Sorry for the delay in answering this question. Life has been hectic lately.

On Sat, Feb 20, 2010 at 2:42 PM, Ted Bergeron <tedb...@triview.com> wrote:
>
> http://appfuse.org/display/APF/Using+Hibernate
>
> I was looking at the above page and noticed a problem in the example
> integration test.
>
> Looks like the test is trying to do too much.  If your Dao save, get or
> remove methods throw the exception, the test will pass.  I think you'd
> either have to break it into multiple tests, or put a try/catch around the
> save through remove lines and in the catch, manually fail the test.  Then
> only if the very last line is the one to throw the exception does the test
> pass.

That's a good point. I'm assuming you're referring to
@ExpectedException(DataAccessException.class)? We used to have it the
way you suggest before we moved to annotations.

>
> I found this just searching for good integration test examples for Spring 3
> / Hibernate app.  I wonder if someone can answer my question?
>
> I have my DaoIntegrationTests working nicely.  Using the line:
>
>  // Manual flush is required to avoid false positive in test
>       sessionFactory.getCurrentSession().flush();
>
> as mentioned in the spring docs.
> (http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/testing.html)
>
> My question is what about integration tests for Service and Controllers?  I
> don't want those tests to know about sessionFactory, but wouldn't I need to
> flush just the same as with the DaoTest?

I'm not sure of the best answer for this question. Hopefully others
that have used Hibernate on their projects can help out.

>
> Has anyone found any great resources that have detailed examples of
> integration tests?  One last thing I'm fighting is the briefness of the
> Spring 3 docs.  Have you converted your PropertyEditors over to their
> Converter/Formatter API?
>

We haven't done this in AppFuse, but we also don't use many PropertyEditors.

Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to