samedi 24 janvier 2015

android: Replacing service with mockup in certain build config


So I'm using Android Studio, and I have an interface, Potato, and PotatoImpl that talks to a remote server. For development I want to use PotatoMockup, but i don't want the choice between the real server and the mock to be in the code.


I was thinking of a new build type, DebugPotatoMock, who's sourceset includes PotatoMock.java, but then how will potatoFactory in the main sourceset be able to return the mock? I don't want to have a sourceset called PotatoImpl and include it in Debug and Release but not in DebugServerMock... and even that doesn't really solve my problem because where will the factory be and what will it know?





Aucun commentaire:

Enregistrer un commentaire