Created
December 2, 2013 17:04
-
-
Save moltak/7752742 to your computer and use it in GitHub Desktop.
RobolectricGradleTestRunner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gradle.app; | |
import org.junit.runners.model.InitializationError; | |
import org.robolectric.AndroidManifest; | |
import org.robolectric.RobolectricTestRunner; | |
import org.robolectric.annotation.Config; | |
import org.robolectric.res.Fs; | |
public class RobolectricGradleTestRunner extends RobolectricTestRunner { | |
public RobolectricGradleTestRunner(Class<?> testClass) throws InitializationError { | |
super(testClass); | |
} | |
@Override protected AndroidManifest getAppManifest(Config config) { | |
String manifestProperty = System.getProperty("android.manifest"); | |
if (config.manifest().equals(Config.DEFAULT) && manifestProperty != null) { | |
String resProperty = System.getProperty("android.resources"); | |
String assetsProperty = System.getProperty("android.assets"); | |
return new AndroidManifest(Fs.fileFromPath(manifestProperty), Fs.fileFromPath(resProperty), | |
Fs.fileFromPath(assetsProperty)); | |
} | |
return super.getAppManifest(config); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment