Unit Testing for Hibernate Query

2 views
Skip to first unread message

Jason Boccuti

unread,
Jul 9, 2014, 9:00:16 AM7/9/14
to d...@openmrs.org
I'm working on a module that makes hibernate queries to the openmrs database and as I have been working on unit testing, I noticed a slight difference in case sensitivity of queries.  In the module, the hibernate query searches the database for all observations that contain a disease/problem added concept.  The parameters to the query include a list of diseases to search for and the query is case insensitive when searching the database for the specific diseases.  However, when I am writing our unit tests, the testing harness is case sensitive.

I was wondering if this is something that is created due to how the test database is set up from the BaseConceptSensitiveTest class and if there is some way to make the test harness case insensitive also.  I tried searching the dev list to see if this question has already been asked, as I don't want to waste anyone's time, but I was unable to find anything.

Thanks,
Jason

Darius Jazayeri

unread,
Jul 9, 2014, 9:07:48 AM7/9/14
to dev
Hi Jason,

I think the difference is in how the in-memory H2 database handles case-sensitivity versus MySQL. I've mostly ignored this myself, and stuck to just writing unit tests that aren't affected by case.

-Darius


--
OpenMRS Developers: http://go.openmrs.org/dev
Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
Manage your OpenMRS subscriptions at https://id.openmrs.org/

Jason Boccuti

unread,
Jul 9, 2014, 9:27:31 AM7/9/14
to d...@openmrs.org
Thanks Darius.  

I have just been writing my tests with case sensitivity in mind so I don't encounter the problem.
Reply all
Reply to author
Forward
0 new messages