'Library for creating mocks VS creating interfaces and their implementations in tests

For example, we have an application code:

class Processor {
    someService:SomeService;

    constructor(s:SomeService) {
        someService = s;
    }

    process():void  // here we call someService
}

Tests usually can be written in two approaches. First is based on the idea, that the application code has many interfaces (in our example SomeService could be the interface), and we implement those with some stub logic. Another approach is to generate mocks (in our example SomeService is a class, and we mock it).

The question is the next: if we cannot go with the first approach and use the second one this is a marker of a bad architecture - am I right? If yes or no, why?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source