As i stated elsewhere i'm no pro.
i like learning and working with
java and i like to include my latest
toys in every new program i craft - it also serves me as a reference to what i've learned so far.
Actually i'm building a stand alone desktop app and i'm using hibernate + MySql (for tests i'm using Hsql)
At this point i've domain objects that i need to persist to database; so i created Dao objects;
In separated tests i'm
testing method behaviour: if a can add an obj to other's Set, object's interaction and so on; so far so good.
But when it comes to testing db persistence i'm at the crossroads:
before
i saw the light i'd create a UI, introduce some data, check database or even retrieve those data from the UI to check if everything was ok.
Now that i discovered testing (the more i know the less i know
) i want to use it properly.
This means testing my persistence methods; i created an interface with trivial methods:
SaveOrUpdate()
delete()
retrieveById()
sortAll()
etc
I've several Daos implementing this interface.
My first Q is the following:
should i test (with database conn and all)
every Dao?
Another Q:
where can i integrate mock testing? (in this very forum someone told me mocking hibernate session wouldnt be that easy)
On the other hand, testing db persistence makes tests longer
hope i made myself clear enough
thanks in advance