(some MVP, some DI, some MVVM) • High coupling (context everywhere) • Lots of hidden business logic in the app, hard to refactor • API-derived entities used almost directly in the views • Some unit + API tests, but difficult to create for old code • Extensive end-to-end tests • Quite stable, no business case for refactoring
Load color variants • Load related products User interactions • Select color variant • Select related product • Add to cart, wishlist, sign up for reminder
val price: String, val image: Image, val cartButtonState: CartButtonState, val maxQuantity: Int ) enum class CartButtonState { ENABLED, DISABLED, PROCESSING }
state is emitted`() { `when`(addToCartUseCase.execute("sku", 1))).thenReturn(Completable.complete()) dispatcher.dispatch(AddToCart("sku", 1)) testObserver.verifyStates( emptyViewState, // initial viewstate expectedStateAddToCartInprogress, // adding to cart in progress state expectedStateAddToCartSucceeded, // adding to cart succeeded state ) }