当前位置: 首页>>代码示例>>Java>>正文


Java Config.constants方法代码示例

本文整理汇总了Java中org.robolectric.annotation.Config.constants方法的典型用法代码示例。如果您正苦于以下问题:Java Config.constants方法的具体用法?Java Config.constants怎么用?Java Config.constants使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.robolectric.annotation.Config的用法示例。


在下文中一共展示了Config.constants方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConfig

import org.robolectric.annotation.Config; //导入方法依赖的package包/类
@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.resourceDir(),
			defaultConfig.assetDir(),
			defaultConfig.shadows(),
			defaultConfig.instrumentedPackages(),
			defaultConfig.application(),
			defaultConfig.libraries(),
			defaultConfig.constants() == Void.class ? BuildConfig.class : defaultConfig.constants()
	);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:GithubSampleTestRunner.java

示例2: getManifestFactory

import org.robolectric.annotation.Config; //导入方法依赖的package包/类
/**
 * Detects which build system is in use and returns the appropriate ManifestFactory implementation.
 *
 * Custom TestRunner subclasses may wish to override this method to provide alternate configuration.
 *
 * @param config Specification of the SDK version, manifest file, package name, etc.
 */
private ManifestFactory getManifestFactory(Config config) {
    Properties buildSystemApiProperties = getBuildSystemApiProperties();
    if (buildSystemApiProperties != null) {
        return new DefaultManifestFactory(buildSystemApiProperties);
    }

    Class<?> buildConstants = config.constants();
    //noinspection ConstantConditions
    if (BuckManifestFactory.isBuck()) {
        return new BuckManifestFactory();
    } else if (buildConstants != Void.class) {
        return new GradleManifestFactory();
    } else {
        return new MavenManifestFactory();
    }
}
 
开发者ID:bangarharshit,项目名称:Oleaster,代码行数:24,代码来源:RoboOleaster.java

示例3: getConfig

import org.robolectric.annotation.Config; //导入方法依赖的package包/类
@Override
public Config getConfig(Method method) {
  Config c = super.getConfig(method);

  int[] sdkLevel = c.sdk().length == 0 ? SDK : c.sdk();
  Class<?> constants = c.constants() == Void.class ? BuildConfig.class : c.constants();
  Class<? extends Application> application = c.constants() == Application.class ? TestApp.class : c.application();

  return new Config.Builder(c)
      .setSdk(sdkLevel)
      .setConstants(constants)
      .setApplication(application)
      .build();
}
 
开发者ID:yshrsmz,项目名称:historian,代码行数:15,代码来源:ConfiguredRobolectricTestRunner.java

示例4: getAppManifest

import org.robolectric.annotation.Config; //导入方法依赖的package包/类
@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!");
		throw new RuntimeException("No 'constants' field in @Config annotation!");
	}

	final String type = getType(config);
	final String flavor = getFlavor(config);
	final String applicationId = getApplicationId(config);

	final FileFsFile res;
	if (FileFsFile.from(BUILD_OUTPUT, "res", flavor, type).exists()) {
		res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type);
	} else {
		// Use res/merged if the output directory doesn't exist for Data Binding compatibility
		res = FileFsFile.from(BUILD_OUTPUT, "res/merged", flavor, type);
	}
	final FileFsFile assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type);

	final FileFsFile manifest;
	if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) {
		manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml");
	} else {
		// Fallback to the location for library manifests
		manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml");
	}

	Logger.debug("Robolectric assets directory: " + assets.getPath());
	Logger.debug("   Robolectric res directory: " + res.getPath());
	Logger.debug("   Robolectric manifest path: " + manifest.getPath());
	Logger.debug("    Robolectric package name: " + applicationId);
	return new AndroidManifest(manifest, res, assets, applicationId);
}
 
开发者ID:bpatrik,项目名称:mobsoft-lab,代码行数:36,代码来源:RobolectricDaggerTestRunner.java


注:本文中的org.robolectric.annotation.Config.constants方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。