Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 115663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:03:19+00:00 2026-05-11T03:03:19+00:00

I am writing a few test cases that depend on the database being available,

  • 0

I am writing a few test cases that depend on the database being available, so on the @Before and @After I open and close the session (Hibernate), as well as start and finish the transaction.

Now in the process of development sometimes I get exceptions in the test cases, so the @After is never called and I can’t clean up (or rollback the transaction which is what I’d like to do).

I’ve (briefly) checked the documentation and could not find how to catch these unexpected exceptions so I can rollback and let the rest of the tests work ok.

Any pointers ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:03:20+00:00Added an answer on May 11, 2026 at 3:03 am

    According to this resource:

    http://junit.org/apidocs/org/junit/After.html

    The @After method is guaranteed to run, even if an exception is thrown. You’re not calling that method explicitly, are you?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a few extensions to mimic the map and reduce functions in
I'm writing a few little bash scripts under Ubuntu linux. I want to be
I've been writing a few web services for a .net app, now I'm ready
I am writing Eclipse plugins where there are quite a few running jobs. In
I'm writing a java app using eclipse which references a few external jars and
So I'm writing a framework on which I want to base a few apps
I'm writing an SQL Query, where a few of the columns returned need to
I'm working on writing a kernel, and I have a few friends working with
Writing some test scripts in IronPython, I want to verify whether a window is
I'm writing quite a few unit tests and using nosetests to run them. Nose

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.