• @oktux
    link
    28 months ago

    Factory pattern can return a mock type for testing or a production type, as needed, which makes it possible to unit test the code that uses the produced object.

    This quick guide explains it well. Then it improves on it by explaining dependency injection.

    https://github.com/google/guice/wiki/Motivation