Java Code Examples for org.robolectric.res.FsFile#exists()

The following examples show how to use org.robolectric.res.FsFile#exists() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LibraryRobolectricTestRunner.java    From materialandroid with Apache License 2.0 5 votes vote down vote up
@Override
protected AndroidManifest getAppManifest(Config config) {
  AndroidManifest appManifest = super.getAppManifest(config);
  FsFile androidManifestFile = appManifest.getAndroidManifestFile();

  if (androidManifestFile.exists()) {
    return appManifest;
  } else {
    androidManifestFile = FileFsFile.from(appManifest.getAndroidManifestFile().getPath()
        .replace("manifests/full", "manifests/aapt"));
    return new AndroidManifest(androidManifestFile, appManifest.getResDirectory(), appManifest.getAssetsDirectory());
  }
}
 
Example 2
Source File: AppRobolectricRunner.java    From MVPAndroidBootstrap with Apache License 2.0 5 votes vote down vote up
protected AndroidManifest getAppManifest(Config config) {
    AndroidManifest appManifest = super.getAppManifest(config);
    FsFile androidManifestFile = appManifest.getAndroidManifestFile();

    if (androidManifestFile.exists()) {
        return appManifest;
    } else {
        String moduleRoot = getModuleRootPath(config);
        androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("bundles", "manifests/full"));
        FsFile resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath());
        FsFile assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath());
        return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
    }
}
 
Example 3
Source File: LibraryRobolectricTestRunner.java    From SnackbarBuilder with Apache License 2.0 5 votes vote down vote up
@Override
protected AndroidManifest getAppManifest(Config config) {
  AndroidManifest appManifest = super.getAppManifest(config);
  FsFile androidManifestFile = appManifest.getAndroidManifestFile();

  if (androidManifestFile.exists()) {
    return appManifest;
  } else {
    androidManifestFile = FileFsFile.from(appManifest.getAndroidManifestFile().getPath()
        .replace("manifests/full", "manifests/aapt"));
    return new AndroidManifest(androidManifestFile, appManifest.getResDirectory(), appManifest.getAssetsDirectory());
  }
}
 
Example 4
Source File: TickmateTestRunner.java    From tickmate with GNU General Public License v3.0 5 votes vote down vote up
protected AndroidManifest getAppManifest(Config config) {
    AndroidManifest appManifest = super.getAppManifest(config);
    FsFile androidManifestFile = appManifest.getAndroidManifestFile();

    if (androidManifestFile.exists()) {
        return appManifest;
    } else {
        androidManifestFile = FileFsFile.from(MODULE_ROOT, "src/main/AndroidManifest.xml");
        FsFile resDirectory = FileFsFile.from(MODULE_ROOT, "src/main/res");
        FsFile assetsDirectory = FileFsFile.from(MODULE_ROOT, "src/main/assets");

        return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
    }
}