本文整理了Java中org.robolectric.annotation.Config.manifest()
方法的一些代码示例,展示了Config.manifest()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.manifest()
方法的具体详情如下:
包路径:org.robolectric.annotation.Config
类名称:Config
方法名:manifest
暂无
代码示例来源:origin: robolectric/robolectric
@Override
public ManifestIdentifier identify(Config config) {
final String manifestPath = config.manifest();
if (manifestPath.equals(Config.NONE)) {
return new ManifestIdentifier((String) null, null, null, null, null);
代码示例来源:origin: robolectric/robolectric
this.maxSdk = pick(this.maxSdk, overlayMaxSdk, DEFAULT_VALUE_INT);
this.manifest = pick(this.manifest, overlayConfig.manifest(), DEFAULT_VALUE_STRING);
代码示例来源:origin: robolectric/robolectric
@Test public void defaultValuesAreMerged() throws Exception {
assertThat(configFor(Test2.class, "withoutAnnotation").manifest())
.isEqualTo("AndroidManifest.xml");
}
代码示例来源:origin: robolectric/robolectric
@Override
public ManifestIdentifier identify(Config config) {
Path manifestFile = getFileFromProperty("android_merged_manifest");
Path resourcesDir = getFileFromProperty("android_merged_resources");
Path assetsDir = getFileFromProperty("android_merged_assets");
Path apkFile = getFileFromProperty("android_resource_apk");
String packageName = properties.getProperty("android_custom_package");
String manifestConfig = config.manifest();
if (Config.NONE.equals(manifestConfig)) {
Logger.info("@Config(manifest = Config.NONE) specified while using Build System API, ignoring");
} else if (!Config.DEFAULT_MANIFEST_NAME.equals(manifestConfig)) {
manifestFile = getResource(manifestConfig);
}
if (!Config.DEFAULT_RES_FOLDER.equals(config.resourceDir())) {
resourcesDir = getResource(config.resourceDir());
}
if (!Config.DEFAULT_ASSET_FOLDER.equals(config.assetDir())) {
assetsDir = getResource(config.assetDir());
}
if (!Config.DEFAULT_PACKAGE_NAME.equals(config.packageName())) {
packageName = config.packageName();
}
List<ManifestIdentifier> libraryDirs = emptyList();
if (config.libraries().length > 0) {
Logger.info("@Config(libraries) specified while using Build System API, ignoring");
}
return new ManifestIdentifier(packageName, manifestFile, resourcesDir, assetsDir, libraryDirs,
apkFile);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testDefaults() throws Exception {
Config defaults = Config.Builder.defaults().build();
assertThat(defaults.manifest()).isEqualTo("AndroidManifest.xml");
assertThat(defaults.resourceDir()).isEqualTo("res");
assertThat(defaults.assetDir()).isEqualTo("assets");
}
代码示例来源:origin: robolectric/robolectric
@Test public void globalValuesAreMerged() throws Exception {
assertThat(configFor(Test2.class, "withoutAnnotation",
new Config.Builder().setManifest("ManifestFromGlobal.xml").build()).manifest())
.isEqualTo("ManifestFromGlobal.xml");
}
代码示例来源:origin: robolectric/robolectric
public Builder(Config config) {
sdk = config.sdk();
minSdk = config.minSdk();
maxSdk = config.maxSdk();
manifest = config.manifest();
qualifiers = config.qualifiers();
packageName = config.packageName();
resourceDir = config.resourceDir();
assetDir = config.assetDir();
shadows = config.shadows();
instrumentedPackages = config.instrumentedPackages();
application = config.application();
libraries = config.libraries();
}
代码示例来源:origin: robolectric/robolectric
private static void assertConfig(
Config config,
int[] sdk,
String manifest,
Class<? extends Application> application,
String packageName,
String qualifiers,
String resourceDir,
String assetsDir,
Class<?>[] shadows,
String[] instrumentedPackages,
String[] libraries) {
assertThat(config.sdk()).isEqualTo(sdk);
assertThat(config.manifest()).isEqualTo(manifest);
assertThat(config.application()).isEqualTo(application);
assertThat(config.packageName()).isEqualTo(packageName);
assertThat(config.qualifiers()).isEqualTo(qualifiers);
assertThat(config.resourceDir()).isEqualTo(resourceDir);
assertThat(config.assetDir()).isEqualTo(assetsDir);
assertThat(config.shadows()).asList().containsAllIn(shadows).inOrder();
assertThat(config.instrumentedPackages()).asList().containsAllIn(instrumentedPackages);
assertThat(config.libraries()).asList().containsAllIn(libraries);
}
代码示例来源:origin: org.robolectric/robolectric
@Override
public ManifestIdentifier identify(Config config) {
final String manifestPath = config.manifest();
if (manifestPath.equals(Config.NONE)) {
return new ManifestIdentifier((String) null, null, null, null, null);
代码示例来源:origin: org.robolectric/robolectric
@Override
public ManifestIdentifier identify(Config config) {
FsFile manifestFile = getFsFileFromProperty("android_merged_manifest");
FsFile resourcesDir = getFsFileFromProperty("android_merged_resources");
FsFile assetsDir = getFsFileFromProperty("android_merged_assets");
FsFile apkFile = getFsFileFromProperty("android_resource_apk");
String packageName = properties.getProperty("android_custom_package");
String manifestConfig = config.manifest();
if (Config.NONE.equals(manifestConfig)) {
Logger.info("@Config(manifest = Config.NONE) specified while using Build System API, ignoring");
} else if (!Config.DEFAULT_MANIFEST_NAME.equals(manifestConfig)) {
manifestFile = resolveFile(manifestConfig);
}
if (!Config.DEFAULT_RES_FOLDER.equals(config.resourceDir())) {
resourcesDir = resolveFile(config.resourceDir());
}
if (!Config.DEFAULT_ASSET_FOLDER.equals(config.assetDir())) {
assetsDir = resolveFile(config.assetDir());
}
if (!Config.DEFAULT_PACKAGE_NAME.equals(config.packageName())) {
packageName = config.packageName();
}
List<ManifestIdentifier> libraryDirs = emptyList();
if (config.libraries().length > 0) {
Logger.info("@Config(libraries) specified while using Build System API, ignoring");
}
return new ManifestIdentifier(packageName, manifestFile, resourcesDir, assetsDir, libraryDirs,
apkFile);
}
代码示例来源:origin: stackoverflow.com
@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");
AndroidManifest manifest = new AndroidManifest(Fs.fileFromPath(manifestProperty), Fs.fileFromPath(resProperty),
Fs.fileFromPath(assetsProperty));
manifest.setPackageName("com.mypackagename");
return manifest;
}
return super.getAppManifest(config);
}
代码示例来源:origin: stackoverflow.com
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");
代码示例来源:origin: org.robolectric/annotations
this.maxSdk = pick(this.maxSdk, overlayMaxSdk, DEFAULT_VALUE_INT);
this.manifest = pick(this.manifest, overlayConfig.manifest(), DEFAULT_VALUE_STRING);
代码示例来源:origin: robospock/RoboSpock
protected AndroidManifest getAppManifest(Config config) {
if (config.manifest().equals(Config.NONE)) {
return null;
FsFile assetDir;
boolean defaultManifest = config.manifest().equals(Config.DEFAULT);
if (defaultManifest && manifestProperty != null) {
manifestFile = Fs.fileFromPath(manifestProperty);
baseDir = manifestFile.getParent();
} else {
manifestFile = getBaseDir().join(defaultManifest ? AndroidManifest.DEFAULT_MANIFEST_NAME : config.manifest());
baseDir = manifestFile.getParent();
代码示例来源:origin: org.robolectric/annotations
public Builder(Config config) {
sdk = config.sdk();
minSdk = config.minSdk();
maxSdk = config.maxSdk();
manifest = config.manifest();
qualifiers = config.qualifiers();
packageName = config.packageName();
resourceDir = config.resourceDir();
assetDir = config.assetDir();
shadows = config.shadows();
instrumentedPackages = config.instrumentedPackages();
application = config.application();
libraries = config.libraries();
}
代码示例来源:origin: ImangazalievM/Bubbble
@Override
public Config getConfig(@NonNull Method method) {
final Config defaultConfig = super.getConfig(method);
return new Config.Implementation(
new int[]{SDK_EMULATE_LEVEL},
defaultConfig.manifest(),
defaultConfig.qualifiers(),
defaultConfig.packageName(),
defaultConfig.abiSplit(),
defaultConfig.resourceDir(),
defaultConfig.assetDir(),
defaultConfig.buildDir(),
defaultConfig.shadows(),
defaultConfig.instrumentedPackages(),
BubbbleTestApplication.class, // Notice that we override real application class for Unit tests.
defaultConfig.libraries(),
defaultConfig.constants() == Void.class ? BuildConfig.class : defaultConfig.constants()
);
}
代码示例来源:origin: ImangazalievM/ReActiveAndroid
@Override
public Config getConfig(@NonNull Method method) {
final Config defaultConfig = super.getConfig(method);
return new Config.Implementation(
new int[]{SDK_EMULATE_LEVEL},
defaultConfig.manifest(),
defaultConfig.qualifiers(),
defaultConfig.packageName(),
defaultConfig.abiSplit(),
defaultConfig.resourceDir(),
defaultConfig.assetDir(),
defaultConfig.buildDir(),
defaultConfig.shadows(),
defaultConfig.instrumentedPackages(),
TestApp.class, // Notice that we override real application class for Unit tests.
defaultConfig.libraries(),
defaultConfig.constants() == Void.class ? BuildConfig.class : defaultConfig.constants()
);
}
内容来源于网络,如有侵权,请联系作者删除!