We are using hibernate search and its orm mapper together with JPA for our Java based search services. The challenge I'm facing is to write unit tests, such as:
- Insert JPA entity car "tesla v3"
- Search for "tesla"
- Validate the JPA entity "tesla v3" to be contained in the result set of hibernate search
To do so, my first thought was to run some kind of in-memory, single node elastic cluster, test against this cluster, and tear it down afterwards. But it seems that there exists no such thing.
The official documentation (https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/) does not explain unit testing for hibernate search.
Now I'm curious how you test your hibernate search implementations. Do I need a test instance? Do you rename your indices for testing and clear it before each test run?
I'm grateful for every input!