I am new to the Lagom world. I have a scenario to work with unit tests. I work under the Lagom / Java framework and a Cassandra database. I have two different services:
My need is an intelligent access scenario. A user must register his device to have access authorization. This mechanism is managed by a WBS connect () in the device service. So this WBS deals with:
If the device is not available: it stores it in the DB (for security reasons) and does not allow access
If the device is registered: it records the date of the access and authorizes the access
My implementation is ready, it works fine. But my question is how to handle this in the unit test side. Especially for the autorized access scenario because for a test start, I do not have a device registered in my DB / persistence.
Best I can tell, the Lagom team doesn't believe in traditional unit testing for services; however, there are some unit-style ways to approach testing Lagom services. This is traditionally how testing is prescribed on a "unit" level:
As you probably know, Lagom prescribes a Spring-style API/Impl bifurcation. As a consequence, domain objects tend to fall into the API tests and the others fall into Impl tests. This should make sense from a DDD standpoint.
Without much imagination, you can probably see how extending the single service tests could span to multiple service tests or integration tests.