// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
// 
//     private final CartDataSource cartDataSource;
//     private final CartStore cartStore;
// 
//     public CartService(CartDataSource cartDataSource, CartStore cartStore) {
//         this.cartDataSource = cartDataSource;
//         this.cartStore = cartStore;
//     }
// 
//     /**
//      * Gets Cart. This Observable will receive updates every time that the
//      * underlying Cart gets updated.
//      */
//     public Observable<Cart> getCart() {
//         return cartDataSource.getCart()
//                 .compose(cartPublisher())
//                 .toObservable()
//                 .flatMap(cart -> cartStore.observe());
//     }
// 
//     /**
//      * Add a product to the Cart.
//      */
//     public Single<Cart> addProduct(CartProduct cartProduct) {
//         return cartDataSource.addProduct(cartProduct)
//                 .compose(cartPublisher());
//     }
// 
//     /**
//      * Remove a product to the Cart.
//      */
//     public Single<Cart> removeProduct(CartProduct cartProduct) {
//         return cartDataSource.removeProduct(cartProduct)
//                 .compose(cartPublisher());
//     }
// 
//     /**
//      * Clear Cart content.
//      */
//     public Completable clear() {
//         return cartDataSource.emptyCart()
//                 .compose(cartPublisher())
//                 .toCompletable();
//     }
// 
//     private SingleTransformer<Cart, Cart> cartPublisher() {
//         return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
//     }
// }
// 
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
// 
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
// 
//     private final ProductDataSource productDataSource;
// 
//     public ProductService(ProductDataSource productDataSource) {
//         this.productDataSource = productDataSource;
//     }
// 
//     public Single<ProductResponse> getAllCatalog() {
//         return productDataSource.getAllCatalog()
//                 .map(ProductResponse::new);
//     }
// }
// 
// Path: app/src/main/java/de/czyrux/store/inject/DataDependenciesFactory.java
// public interface DataDependenciesFactory {
//     CartDataSource createCartDataSource();
// 
//     ProductDataSource createProductDataSource();
// }
// 
// Path: app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
// public class DefaultDependenciesFactory implements DependenciesFactory {
// 
//     private final DataDependenciesFactory dataDependenciesFactory;
//     private final CartStore cartStore;
// 
//     public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
//         this.dataDependenciesFactory = dataDependenciesFactory;
//         cartStore = new CartStore();
//     }
// 
//     @Override
//     public CartService createCartService() {
//         return new CartService(dataDependenciesFactory.createCartDataSource(), cartStore);
//     }
// 
//     @Override
//     public ProductService createProductService() {
//         return new ProductService(dataDependenciesFactory.createProductDataSource());
//     }
// 
//     @Override
//     public CartStore createCartStore() {
//         return cartStore;
//     }
// }
// 
// Path: app/src/main/java/de/czyrux/store/inject/DependenciesFactory.java
// public interface DependenciesFactory {
//     CartService createCartService();
// 
//     ProductService createProductService();
// 
//     CartStore createCartStore();
// }


import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
import de.czyrux.store.inject.DataDependenciesFactory;
import de.czyrux.store.inject.DefaultDependenciesFactory;
import de.czyrux.store.inject.DependenciesFactory;
    public static class Builder {
        private final DependenciesFactory defaultDependenciesFactory;
        private CartStore cartStore;
        private CartService cartService;
        private ProductService productService;

        private Builder(DependenciesFactory dependenciesFactory) {
            defaultDependenciesFactory = dependenciesFactory;
        }

        public Builder overrideCartStore(CartStore cartStore) {
            this.cartStore = cartStore;
            return this;
        }

        public Builder overrideCartService(CartService cartService) {
            this.cartService = cartService;
            return this;
        }

        public Builder overrideProductService(ProductService productService) {
            this.productService = productService;
            return this;
        }

        public TestDependenciesFactory build() {
            if (cartStore == null) {
                cartStore = defaultDependenciesFactory.createCartStore();
            }

// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
// 
//     private final CartDataSource cartDataSource;
//     private final CartStore cartStore;
// 
//     public CartService(CartDataSource cartDataSource, CartStore cartStore) {
//         this.cartDataSource = cartDataSource;
//         this.cartStore = cartStore;
//     }
// 
//     /**
//      * Gets Cart. This Observable will receive updates every time that the
//      * underlying Cart gets updated.
//      */
//     public Observable<Cart> getCart() {
//         return cartDataSource.getCart()
//                 .compose(cartPublisher())
//                 .toObservable()
//                 .flatMap(cart -> cartStore.observe());
//     }
// 
//     /**
//      * Add a product to the Cart.
//      */
//     public Single<Cart> addProduct(CartProduct cartProduct) {
//         return cartDataSource.addProduct(cartProduct)
//                 .compose(cartPublisher());
//     }
// 
//     /**
//      * Remove a product to the Cart.
//      */
//     public Single<Cart> removeProduct(CartProduct cartProduct) {
//         return cartDataSource.removeProduct(cartProduct)
//                 .compose(cartPublisher());
//     }
// 
//     /**
//      * Clear Cart content.
//      */
//     public Completable clear() {
//         return cartDataSource.emptyCart()
//                 .compose(cartPublisher())
//                 .toCompletable();
//     }
// 
//     private SingleTransformer<Cart, Cart> cartPublisher() {
//         return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
//     }
// }
// 
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
// 
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
// 
//     private final ProductDataSource productDataSource;
// 
//     public ProductService(ProductDataSource productDataSource) {
//         this.productDataSource = productDataSource;
//     }
// 
//     public Single<ProductResponse> getAllCatalog() {
//         return productDataSource.getAllCatalog()
//                 .map(ProductResponse::new);
//     }
// }
// 
// Path: app/src/main/java/de/czyrux/store/inject/DataDependenciesFactory.java
// public interface DataDependenciesFactory {
//     CartDataSource createCartDataSource();
// 
//     ProductDataSource createProductDataSource();
// }
// 
// Path: app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
// public class DefaultDependenciesFactory implements DependenciesFactory {
// 
//     private final DataDependenciesFactory dataDependenciesFactory;
//     private final CartStore cartStore;
// 
//     public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
//         this.dataDependenciesFactory = dataDependenciesFactory;
//         cartStore = new CartStore();
//     }
// 
//     @Override
//     public CartService createCartService() {
//         return new CartService(dataDependenciesFactory.createCartDataSource(), cartStore);
//     }
// 
//     @Override
//     public ProductService createProductService() {
//         return new ProductService(dataDependenciesFactory.createProductDataSource());
//     }
// 
//     @Override
//     public CartStore createCartStore() {
//         return cartStore;
//     }
// }
// 
// Path: app/src/main/java/de/czyrux/store/inject/DependenciesFactory.java
// public interface DependenciesFactory {
//     CartService createCartService();
// 
//     ProductService createProductService();
// 
//     CartStore createCartStore();
// }


// Path: app/src/androidTest/java/de/czyrux/store/toolbox/mock/TestDependenciesFactory.java
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
import de.czyrux.store.inject.DataDependenciesFactory;
import de.czyrux.store.inject.DefaultDependenciesFactory;
import de.czyrux.store.inject.DependenciesFactory;

    public static class Builder {
        private final DependenciesFactory defaultDependenciesFactory;
        private CartStore cartStore;
        private CartService cartService;
        private ProductService productService;

        private Builder(DependenciesFactory dependenciesFactory) {
            defaultDependenciesFactory = dependenciesFactory;
        }

        public Builder overrideCartStore(CartStore cartStore) {
            this.cartStore = cartStore;
            return this;
        }

        public Builder overrideCartService(CartService cartService) {
            this.cartService = cartService;
            return this;
        }

        public Builder overrideProductService(ProductService productService) {
            this.productService = productService;
            return this;
        }

        public TestDependenciesFactory build() {
            if (cartStore == null) {
                cartStore = defaultDependenciesFactory.createCartStore();
            }

            if (cartService == null) {