All Questions
4 questions
2
votes
2
answers
1k
views
Migrating legacy code with singletons to Dependency injection
I'm working on a larger, older project. Our code is littered with classical singletons, i.e. classes like
public class ABCService {
private static final instance = new ABCService();
public ...
2
votes
1
answer
339
views
Using Spring in Java Project
I've got a question about a correct usage of Spring.
I know that some people use the DI "aggressively" so that they always use spring and completely eliminate the usage of word "new" in the ...
10
votes
2
answers
10k
views
Unit testing, factories, and the Law of Demeter
Here's how my code works. I have an object that represents the current state of something akin to a shopping cart order, stored in a 3rd party shopping API. In my controller code, I want to be able to ...
1
vote
1
answer
127
views
Loading data for ShoppingCart item
I'm currently trying to cover our shopping cart with unit tests.
Class ShoppingCartItem has property Term. It also loads available terms for this item upon object creation. Currently this is done ...