I have a simple class, that contains a list:
public class SomeClass {
    private AppDataSource appDataSource; // it's interface
    private List<Object> someList;
    ////
    public List<Obejct> loadSomeList() {
        if (someList == null) {
            return appDataSource.getListFromDatabase();
        }
        retrunf someList;
    }
}
The point is - i want that list to be loaded from DB only once. And i want to unit test this function. I am noob in TDD and all i could do - write a public getter and setter for someList and use them in unit test. But it's conceptually wrong - i don't want class's clients use this member variable directlty.
How can i properly test method in this situation?
 
     
     
     
     
     
     
    