Discussion about this post

User's avatar
Morten Hindsholm's avatar

I really like this approach but I don't see how you can avoid mocking.

The test you sketch out:

```

var result = OrderOperations.placeOrder(request);

assertInstanceOf(OutOfStock.class, result);

```

will AFAIK require some mocking of the OrderOperations class or did I miss something?

Tomasz Kucharzyk's avatar

Great article but I can’t get the point why this approach is better. You said it will simplify testing, but given example compare integration test using active record with unit test that mocks repositories. If we use integration tests for both approaches it would be pretty much similar. For me active record hides dependencies - we are pretending that we have pure static methods but data access is still there

4 more comments...

No posts

Ready for more?