I've got a method which is dependant on BuildConfig.BUILD_TYPE, and I'd like to unittest it. A simple example:
public boolean isDebug() {
return BuildConfig.BUILD_TYPE.equalsIgnoreCase("debug");
}
Is there any way to mock this build type? Or any other way I could gracefully test methods using BuildConfigs in general?
My best guess up to now is having a class that is a 'getter' for the BuildConfigs (with simple methods like above), then mocking this class whenever I'd like to use BuildConfigs in other situations. But of course I cannot unittest this class itself, which is a waste.
Aucun commentaire:
Enregistrer un commentaire