26
26
import org .robolectric .RobolectricTestRunner ;
27
27
import org .robolectric .annotation .Config ;
28
28
import org .robolectric .internal .bytecode .InstrumentationConfiguration ;
29
- import org .robolectric .manifest .AndroidManifest ;
30
- import org .robolectric .res .FileFsFile ;
31
- import org .robolectric .res .FsFile ;
32
29
33
- /**
34
- * For custom manifest hack, see:
35
- * https://gist.github.com/venator85/282df3677af9ecac56e5e4b91471cd8f
36
- */
37
30
public class CustomRobolectricGradleTestRunner extends RobolectricTestRunner {
38
31
public CustomRobolectricGradleTestRunner (Class <?> klass ) throws InitializationError {
39
32
super (klass );
@@ -53,32 +46,4 @@ public InstrumentationConfiguration createClassLoaderConfig(Config config) {
53
46
54
47
return builder .build ();
55
48
}
56
-
57
- @ Override
58
- protected AndroidManifest getAppManifest (Config config ) {
59
- AndroidManifest appManifest = super .getAppManifest (config );
60
- FsFile androidManifestFile = appManifest .getAndroidManifestFile ();
61
-
62
- if (androidManifestFile .exists ()) {
63
- return appManifest ;
64
- } else {
65
- // Fixes error 'No such manifest file: build/intermediates/manifests/full/debug/AndroidManifest.xml'
66
- androidManifestFile = FileFsFile .from (
67
- getModuleRootPath (config ),
68
- appManifest .getAndroidManifestFile ()
69
- .getPath ()
70
- .replace ("manifests/full" , "manifests/aapt" ));
71
-
72
- return new AndroidManifest (
73
- androidManifestFile ,
74
- appManifest .getResDirectory (),
75
- appManifest .getAssetsDirectory ());
76
- }
77
- }
78
-
79
- private String getModuleRootPath (Config config ) {
80
- String moduleRoot = config .constants ().getResource ("" ).toString ().replace ("file:" , "" );
81
- return moduleRoot .substring (0 , moduleRoot .indexOf ("/build" ));
82
- }
83
-
84
49
}
0 commit comments