• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

mocking database using easymock

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my google search failed.

Am a newbie and I want to study mocking database (no specific target like connections, resultsets) through an example.

Would anyone please provide some hello world thing on mocking database/sql code using EasyMock?

Anything is OK as I am just a learner.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd forget about mocking an entire database. If you adopt the Data Access Object (DAO) to abstract and encapsulate access to the database, such an object would be a convenient candidate for a test double (possibly using EasyMock). Eventually you'll want to unit test the DAO itself, and then it would make sense to utilize some sort of ligthweight in-memory database, instead of the heavyweight (network accessed) production database server, and employ a library like DbUnit. That's as far as I'd take it for the purpose of unit testing. Eventually, though, you'll want to integrate every system component and test against the real thing, but that's well beyond the scope of unit testing.
 
It would give a normal human mental abilities to rival mine. To think it is just a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic