Java Code Examples for org.robolectric.annotation.Config#packageName()

The following examples show how to use org.robolectric.annotation.Config#packageName() . 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: GithubSampleTestRunner.java    From Moxy with MIT License 6 votes vote down vote up
@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()
	);
}
 
Example 2
Source File: ForageRoboelectricUnitTestRunner.java    From Forage with Mozilla Public License 2.0 6 votes vote down vote up
@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(),
            ForageUnitTestApplication.class,
            defaultConfig.libraries(),
            defaultConfig.constants() == Void.class ? BuildConfig.class : defaultConfig.constants()
    );
}
 
Example 3
Source File: ForageRoboelectricIntegrationTestRunner.java    From Forage with Mozilla Public License 2.0 6 votes vote down vote up
@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(),
            ForageUnitTestApplication.class,
            defaultConfig.libraries(),
            defaultConfig.constants() == Void.class ? BuildConfig.class : defaultConfig.constants()
    );
}
 
Example 4
Source File: HokoGradleTestRunner.java    From hoko-android with Apache License 2.0 5 votes vote down vote up
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;
    }
}
 
Example 5
Source File: CustomRunner.java    From algoliasearch-client-android with MIT License 5 votes vote down vote up
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;
    }
}