As more unit tests are added regularly, they are getting hard to maintain because part of their implementation is in specific classes and part of it is in MockServer.java, which has grown to 2500 lines in mod-orders.
We can start with mod-orders, but this issue should be addressed for all backend modules.
Unit test implementations should be more distributed, so that MockServer only contains minimal generic code and nothing related to a specific test.
If a test needs the mock server to respond to a particular query with a given response, it should call a generic method of MockServer giving the request method, path and parameters (with regular expressions if needed), and the reply. If several tests in a test file are using the same request/response, setup can be added in the before() method.
1. Replace MockServer with WireMock (look mod-organizations)
2. All API stubs should be done directly in the test method.
3. API tests name should end with "IT" and place in the package "it": orders.it.OrdersIT
- MockServer refactoring
- All existing tests should still exist and pass