# Clarifying Unit vs Integration Tests in storage Module (JDBC + Mockito vs Dataset Tests)

**URL:** <https://talk.openelis-global.org/t/clarifying-unit-vs-integration-tests-in-storage-module-jdbc-mockito-vs-dataset-tests/1739>\
**Category:** Development\
**Created:** [December 7, 2025, 10:28pm UTC](https://talk.openelis-global.org/t/clarifying-unit-vs-integration-tests-in-storage-module-jdbc-mockito-vs-dataset-tests/1739 "2025-12-07T22:28:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Agaba\_Derrick\_Junior](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.openelis-global.org/agaba_derrick_junior/32/503_2.png) [@Agaba\_Derrick\_Junior](https://talk.openelis-global.org/u/Agaba_Derrick_Junior)\
**Post date:** [December 7, 2025, 10:28pm UTC](https://talk.openelis-global.org/t/clarifying-unit-vs-integration-tests-in-storage-module-jdbc-mockito-vs-dataset-tests/1739/1 "2025-12-07T22:28:58Z")

</div>

Hey everyone,  
I’ve noticed that in the `[storage test package](https://github.com/DIGI-UW/OpenELIS-Global-2/tree/develop/src/test/java/org/openelisglobal/storage), we currently have a mix of:

- Spring + DBUnit integration tests (using `BaseWebContextSensitiveTest`), and
- Pure Mockito-based unit tests that mock `EntityManager`, `Session`, and `Query` for DAO classes.

From what I understand, we have been favoring **dataset-driven integration tests over mocked persistence tests** as a culture.

Before I proceed with refactoring the storage tests following an issue of [migrating and removing JDBC/Mockito-based DAO tests](https://github.com/DIGI-UW/OpenELIS-Global-2/issues/2401), I’d like confirmation on:

- Should all storage persistence tests be converted to **pure integration tests only**?
- Is it acceptable to **delete and replace Mockito-based DAO tests with dataset-backed DAO integration tests**?

This will help ensure we align with the project’s intended testing philosophy and avoid future inconsistency.  
@Moses_Mutesasira @mherman22

---

<div class="post-metadata">

**Author:** ![Moses\_Mutesasira](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.openelis-global.org/moses_mutesasira/32/72_2.png) [@Moses\_Mutesasira](https://talk.openelis-global.org/u/Moses_Mutesasira)\
**Post date:** [December 8, 2025, 9:26am UTC](https://talk.openelis-global.org/t/clarifying-unit-vs-integration-tests-in-storage-module-jdbc-mockito-vs-dataset-tests/1739/2 "2025-12-08T09:26:49Z")

</div>

> [@Agaba\_Derrick\_Junior](#):
>
> storage test package

Thanks @Agaba_Derrick_Junior for the catch.  
we would want to follw our existing integration tests structure and also want to avoid mocking services as much as we can since they habour errors
