• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about testing the update method in database layer

 
Mark O' Sullivan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Currently testing the database layer functionality in my application(hopefully for last time), Just wondering is this acceptable for exception handling? If an exception occurs say in my update method, for example, a null array parameter is passed, I throw an exception. Clearly in my code though, if this occurs, I have obtained the lock already on the record number, but if the exception is thrown I have no way of then unlocking the recordNumber. Is the following acceptable say for testing the update method.

or does the following have to work automatically considering SUN's tests?

Thanks, hope my question is clear.
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

Have you ever heard about the finally-block when handling exceptions?

Kind regards,
Roel
 
Mark O' Sullivan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, lapse of concentration, actually have that in my business methods.
Cheers, apologises.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic