use of org.robolectric.internal.SdkConfig in project robolectric by robolectric.
the class RobolectricTestRunnerTest method equalityOfRobolectricFrameworkMethod.
@Test
public void equalityOfRobolectricFrameworkMethod() throws Exception {
Method method = TestWithTwoMethods.class.getMethod("first");
RobolectricFrameworkMethod rfm16 = new RobolectricFrameworkMethod(method, mock(AndroidManifest.class), new SdkConfig(16), mock(Config.class));
RobolectricFrameworkMethod rfm17 = new RobolectricFrameworkMethod(method, mock(AndroidManifest.class), new SdkConfig(17), mock(Config.class));
RobolectricFrameworkMethod rfm16b = new RobolectricFrameworkMethod(method, mock(AndroidManifest.class), new SdkConfig(16), mock(Config.class));
assertThat(rfm16).isEqualTo(rfm16);
assertThat(rfm16).isNotEqualTo(rfm17);
assertThat(rfm16).isEqualTo(rfm16b);
assertThat(rfm16.hashCode()).isEqualTo((rfm16b.hashCode()));
}
use of org.robolectric.internal.SdkConfig in project robolectric by robolectric.
the class SdkPickerTest method withAllSdksConfigAndNoMinSdkVersion_shouldUseFullSdkRangeFromAndroidManifest.
@Test
public void withAllSdksConfigAndNoMinSdkVersion_shouldUseFullSdkRangeFromAndroidManifest() throws Exception {
when(appManifest.getTargetSdkVersion()).thenReturn(22);
when(appManifest.getMinSdkVersion()).thenReturn(1);
when(appManifest.getMaxSdkVersion()).thenReturn(22);
assertThat(sdkPicker.selectSdks(new Config.Builder().setSdk(Config.ALL_SDKS).build(), appManifest)).containsExactly(new SdkConfig(16), new SdkConfig(17), new SdkConfig(18), new SdkConfig(19), new SdkConfig(21), new SdkConfig(22));
}
use of org.robolectric.internal.SdkConfig in project robolectric by robolectric.
the class SdkPickerTest method withAllSdksConfig_shouldUseFullSdkRangeFromAndroidManifest.
@Test
public void withAllSdksConfig_shouldUseFullSdkRangeFromAndroidManifest() throws Exception {
when(appManifest.getTargetSdkVersion()).thenReturn(22);
when(appManifest.getMinSdkVersion()).thenReturn(19);
when(appManifest.getMaxSdkVersion()).thenReturn(23);
assertThat(sdkPicker.selectSdks(new Config.Builder().setSdk(Config.ALL_SDKS).build(), appManifest)).containsExactly(new SdkConfig(19), new SdkConfig(21), new SdkConfig(22), new SdkConfig(23));
}
use of org.robolectric.internal.SdkConfig in project robolectric by robolectric.
the class SdkPickerTest method withExplicitSdkConfig_selectSdks.
@Test
public void withExplicitSdkConfig_selectSdks() throws Exception {
when(appManifest.getTargetSdkVersion()).thenReturn(21);
when(appManifest.getMinSdkVersion()).thenReturn(19);
when(appManifest.getMaxSdkVersion()).thenReturn(22);
assertThat(sdkPicker.selectSdks(new Config.Builder().setSdk(21).build(), appManifest)).containsExactly(new SdkConfig(21));
assertThat(sdkPicker.selectSdks(new Config.Builder().setSdk(Config.OLDEST_SDK).build(), appManifest)).containsExactly(new SdkConfig(19));
assertThat(sdkPicker.selectSdks(new Config.Builder().setSdk(Config.TARGET_SDK).build(), appManifest)).containsExactly(new SdkConfig(21));
assertThat(sdkPicker.selectSdks(new Config.Builder().setSdk(Config.NEWEST_SDK).build(), appManifest)).containsExactly(new SdkConfig(22));
assertThat(sdkPicker.selectSdks(new Config.Builder().setSdk(16).build(), appManifest)).containsExactly(new SdkConfig(16));
assertThat(sdkPicker.selectSdks(new Config.Builder().setSdk(23).build(), appManifest)).containsExactly(new SdkConfig(23));
}
use of org.robolectric.internal.SdkConfig in project robolectric by robolectric.
the class SdkPickerTest method withAllSdksConfigAndNoMaxSdkVersion_shouldUseFullSdkRangeFromAndroidManifest.
@Test
public void withAllSdksConfigAndNoMaxSdkVersion_shouldUseFullSdkRangeFromAndroidManifest() throws Exception {
when(appManifest.getTargetSdkVersion()).thenReturn(22);
when(appManifest.getMinSdkVersion()).thenReturn(19);
when(appManifest.getMaxSdkVersion()).thenReturn(null);
assertThat(sdkPicker.selectSdks(new Config.Builder().setSdk(Config.ALL_SDKS).build(), appManifest)).containsExactly(new SdkConfig(19), new SdkConfig(21), new SdkConfig(22), new SdkConfig(23));
}
Aggregations