use of org.robolectric.plugins.HierarchicalConfigurationStrategy.ConfigurationImpl in project robolectric by robolectric.
the class RobolectricTestRunner method getConfiguration.
/**
* Calculate the configuration for a given test method.
*/
private Configuration getConfiguration(Method method) {
Configuration configuration = configurationStrategy.getConfig(getTestClass().getJavaClass(), method);
// in case #getConfig(Method) has been overridden...
try {
Config config = getConfig(method);
((ConfigurationImpl) configuration).put(Config.class, config);
} catch (UnsupportedOperationException e) {
// no problem
}
return configuration;
}
use of org.robolectric.plugins.HierarchicalConfigurationStrategy.ConfigurationImpl in project robolectric by robolectric.
the class DefaultSdkPickerTest method buildConfig.
private Configuration buildConfig(Config.Builder builder) {
ConfigurationImpl testConfig = new ConfigurationImpl();
testConfig.put(Config.class, builder.build());
return testConfig;
}
use of org.robolectric.plugins.HierarchicalConfigurationStrategy.ConfigurationImpl in project robolectric by robolectric.
the class AndroidTestEnvironmentTest method setUpApplicationState_setsVersionQualifierFromSdkWithOtherQualifiers.
@Test
public void setUpApplicationState_setsVersionQualifierFromSdkWithOtherQualifiers() {
String givenQualifiers = "large-land";
ConfigurationImpl config = new ConfigurationImpl();
config.put(Config.class, new Config.Builder().setQualifiers(givenQualifiers).build());
config.put(LooperMode.Mode.class, LEGACY);
bootstrapWrapper.changeConfig(config);
bootstrapWrapper.callSetUpApplicationState();
String optsForO = RuntimeEnvironment.getApiLevel() >= O ? "nowidecg-lowdr-" : "";
assertThat(RuntimeEnvironment.getQualifiers()).contains("large-notlong-notround-" + optsForO + "land-notnight-mdpi-finger-keyssoft" + "-nokeys-navhidden-nonav-v" + Build.VERSION.RESOURCES_SDK_INT);
}
use of org.robolectric.plugins.HierarchicalConfigurationStrategy.ConfigurationImpl in project robolectric by robolectric.
the class AndroidTestEnvironmentTest method setUpApplicationState_setsVersionQualifierFromSdk.
@Test
public void setUpApplicationState_setsVersionQualifierFromSdk() {
String givenQualifiers = "";
ConfigurationImpl config = new ConfigurationImpl();
config.put(Config.class, new Config.Builder().setQualifiers(givenQualifiers).build());
config.put(LooperMode.Mode.class, LEGACY);
bootstrapWrapper.changeConfig(config);
bootstrapWrapper.callSetUpApplicationState();
assertThat(RuntimeEnvironment.getQualifiers()).contains("v" + Build.VERSION.RESOURCES_SDK_INT);
}
Aggregations