I have a scenario where I want to reference a private class
- not test that class.
I am using Spring JDBCTemplate
to query db
and using a row mapper (which is private class of dao) for mapping the resultset
to my object
.
Test case is mocking like
when(dao.method(query, rowmapper, param)).thenReturn(something)
Possible solutions: Make rowmapper default access and keep test case in the same package.
However my belief is that why to make code changes for the sake of test cases?
I was wondering if Java reflection
can be of any use in this or not ?
I couldn't find any thing on that so if someone has already been through such thing then please share.