The warmup project shows how to expose some REST APIs to be called from a client as well as a basic HTML UI client.
Things to note about the project in terms of tests:
-
It contains Models tests
-
It contains Controllers tests
-
It contains Routing tests
-
It doesn’t contain any View tests (but should be added in real projects)
-
It doesn’t contain any Integration tests (but should be added in real projects)
For the Controllers test specifically:
-
I could have added asserts that verify the response (e.g. SUCCESS or 200 OK)
-
I could have added asserts that verify the template used
Otherwise, the business logic is mainly kept in the Controllers. This is in fact not necessarily the best approach. A lot of the business logic should have been pushed to the Models instead. Indeed, the “add” and “login” methods could have been pushed at a lower level. The Model offers validation and callbacks to handle these things.