generated tests from existing classes sounds like testing after the fact.

Then I would consider generating the DAOs from information available, like
the database schema or the DTO classes which should be of the record type.

but if you still insist, make the DAO tests inherit from a TestBase class
that configures the mocked data source.
If the DAO accepts the data source or a connection as dependency in the
injection sense, you are good to go and can verify the proper use of the
dependency by the DAO, which is the purpose of mocking.

I may find some time tomorrow to come up with a more elaborate answer.


Kind regards,
Pieter van den Hombergh.


met vriendelijke groet
Pieter van den Hombergh

Op do 29 feb 2024 01:40 schreef Greenberg, Gary <ggree...@visa.com.invalid>:

> I am quite used to generate unit tests for my code using Netbeans
> Tools->Create/Update Tests. JUnit is great.
> However, now I need to create tests for some DAO classes where I will need
> to mock database access.
> I plan to use Mockito for that.  Does Netbeans have any features
> automating Mockito test creation?
>
> *Gary Greenberg*
>
> Staff Software Engineer
>
>
>

Reply via email to