本文整理了Java中org.robolectric.annotation.Config.constants()
方法的一些代码示例,展示了Config.constants()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.constants()
方法的具体详情如下:
包路径:org.robolectric.annotation.Config
类名称:Config
方法名:constants
暂无
代码示例来源:origin: com.github.gfx.android.robolectricinstrumentation/robolectric-instrumentation
private String getType(Config config) {
try {
return ReflectionHelpers.getStaticField(config.constants(), "BUILD_TYPE");
} catch (Throwable e) {
return null;
}
}
代码示例来源:origin: com.github.gfx.android.robolectricinstrumentation/robolectric-instrumentation
private String getPackageName(Config config) {
try {
final String packageName = config.packageName();
if (!packageName.isEmpty()) {
return packageName;
} else {
return config.constants().getPackage().getName();
}
} catch (Exception e) {
return null;
}
}
代码示例来源:origin: robospock/RoboSpock
private static String getType(Config config) {
// Copied from org.robolectric.RobolectricGradleTestRunner
try {
return ReflectionHelpers.getStaticField(config.constants(), "BUILD_TYPE");
} catch (Throwable e) {
return null;
}
}
代码示例来源:origin: maskarade/Robolectric-Instrumentation
private String getType(Config config) {
try {
return ReflectionHelpers.getStaticField(config.constants(), "BUILD_TYPE");
} catch (Throwable e) {
return null;
}
}
代码示例来源:origin: robospock/RoboSpock
private static String getFlavor(Config config) {
// Copied from org.robolectric.RobolectricGradleTestRunner
try {
return ReflectionHelpers.getStaticField(config.constants(), "FLAVOR");
} catch (Throwable e) {
return null;
}
}
代码示例来源:origin: com.github.gfx.android.robolectricinstrumentation/robolectric-instrumentation
private String getFlavor(Config config) {
try {
return ReflectionHelpers.getStaticField(config.constants(), "FLAVOR");
} catch (Throwable e) {
return null;
}
}
代码示例来源:origin: maskarade/Robolectric-Instrumentation
private String getFlavor(Config config) {
try {
return ReflectionHelpers.getStaticField(config.constants(), "FLAVOR");
} catch (Throwable e) {
return null;
}
}
代码示例来源:origin: maskarade/Robolectric-Instrumentation
private String getPackageName(Config config) {
try {
final String packageName = config.packageName();
if (!packageName.isEmpty()) {
return packageName;
} else {
return config.constants().getPackage().getName();
}
} catch (Exception e) {
return null;
}
}
代码示例来源:origin: maskarade/Robolectric-Instrumentation
@Override
protected ManifestFactory getManifestFactory(Config config) {
if (config.constants().equals(Void.class)) {
return super.getManifestFactory(config);
}
return new MyManifestFactory(config);
}
代码示例来源:origin: com.github.gfx.android.robolectricinstrumentation/robolectric-instrumentation
@Override
protected ManifestFactory getManifestFactory(Config config) {
if (config.constants().equals(Void.class)) {
return super.getManifestFactory(config);
}
return new MyManifestFactory(config);
}
代码示例来源:origin: robospock/RoboSpock
private static String getPackageName(Config config) {
// Copied from org.robolectric.RobolectricGradleTestRunner
try {
final String packageName = config.packageName();
if (packageName != null && !packageName.isEmpty()) {
return packageName;
} else {
return ReflectionHelpers.getStaticField(config.constants(), "APPLICATION_ID");
}
} catch (Throwable e) {
return null;
}
}
}
代码示例来源:origin: leeowenowen/AndroidUnitTest
private String getModuleRootPath(Config config) {
String moduleRoot = config.constants().getResource("").toString().replace("file:", "");
// Assert.assertEquals("abc", moduleRoot);
return moduleRoot.substring(0, moduleRoot.indexOf("/build"));
}
代码示例来源:origin: Fewlaps/flone-android
private String getModuleRootPath(Config config) {
String moduleRoot = config.constants().getResource("").toString().replace("file:", "");
return moduleRoot.substring(0, moduleRoot.indexOf("/build"));
}
}
代码示例来源:origin: algolia/algoliasearch-client-android
private String getType(Config config) {
try {
return ReflectionHelpers.getStaticField(config.constants(), "BUILD_TYPE");
} catch (Throwable e) {
return null;
}
}
代码示例来源:origin: algolia/algoliasearch-client-android
private String getFlavor(Config config) {
try {
return ReflectionHelpers.getStaticField(config.constants(), "FLAVOR");
} catch (Throwable e) {
return null;
}
}
代码示例来源:origin: algolia/algoliasearch-client-android
private String getPackageName(Config config) {
try {
final String packageName = config.packageName();
if (packageName != null && !packageName.isEmpty()) {
return packageName;
} else {
return ReflectionHelpers.getStaticField(config.constants(), "APPLICATION_ID");
}
} catch (Throwable e) {
return null;
}
}
}
代码示例来源: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()
);
}
代码示例来源: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: robospock/RoboSpock
@Override
protected AndroidManifest getAppManifest(Config config) {
if (config.constants() == Void.class) {
Logger.error("Field 'constants' not specified in @Config annotation");
Logger.error("This is required when using RobolectricGradleTestRunner!");
代码示例来源:origin: algolia/algoliasearch-client-android
Logger.debug("Current working directory: " + cwd);
if (config.constants() == Void.class) {
Logger.error("Field 'constants' not specified in @Config annotation");
Logger.error("This is required when using RobolectricGradleTestRunner!");
内容来源于网络,如有侵权,请联系作者删除!