@@ -0,0 +1,2934 @@
+package com.braintreepayments.cardform.utils;%0A%0Aimport android.app.Activity;%0Aimport android.graphics.drawable.ColorDrawable;%0Aimport android.view.View;%0Aimport android.view.Window;%0A%0Aimport com.braintreepayments.cardform.R;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.robolectric.RobolectricGradleTestRunner;%0Aimport org.robolectric.RuntimeEnvironment;%0A%0Aimport static junit.framework.Assert.assertEquals;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0A@RunWith(RobolectricGradleTestRunner.class)%0Apublic class ExpirationDateDialogThemeTest %7B%0A%0A    @Test%0A    public void detectTheme_detectsBlackBackgroundAndReturnsLightTheme() %7B%0A        Activity activity = setupActivity(R.color.bt_black);%0A%0A        ExpirationDateDialogTheme theme = ExpirationDateDialogTheme.detectTheme(activity);%0A%0A        assertEquals(ExpirationDateDialogTheme.LIGHT, theme);%0A        assertEquals(getColor(R.color.bt_black_87), theme.getItemTextColor());%0A        assertEquals(getColor(R.color.bt_white_87), theme.getItemInvertedTextColor());%0A        assertEquals(getColor(R.color.bt_black_38), theme.getItemDisabledTextColor());%0A    %7D%0A%0A    @Test%0A    public void detectTheme_detectsWhiteBackgroundAndReturnsDarkTheme() %7B%0A        Activity activity = setupActivity(R.color.bt_white);%0A%0A        ExpirationDateDialogTheme theme = ExpirationDateDialogTheme.detectTheme(activity);%0A%0A        assertEquals(ExpirationDateDialogTheme.DARK, theme);%0A        assertEquals(getColor(R.color.bt_white_87), theme.getItemTextColor());%0A        assertEquals(getColor(R.color.bt_black_87), theme.getItemInvertedTextColor());%0A        assertEquals(getColor(R.color.bt_white_38), theme.getItemDisabledTextColor());%0A    %7D%0A%0A    @Test%0A    public void getSelectedItemBackground_returnsDefaultColorWhenThereIsNoAccentColor() %7B%0A        Activity activity = setupActivity(R.color.bt_white);%0A%0A        ExpirationDateDialogTheme theme = ExpirationDateDialogTheme.detectTheme(activity);%0A%0A        assertEquals(getColor(R.color.bt_blue), theme.getSelectedItemBackground());%0A    %7D%0A%0A    private Activity setupActivity(int backgroundColor) %7B%0A        ColorDrawable colorDrawable = mock(ColorDrawable.class);%0A        when(colorDrawable.getColor()).thenReturn(getColor(backgroundColor));%0A        View rootView = mock(View.class);%0A        when(rootView.getBackground()).thenReturn(colorDrawable);%0A        View decorView = mock(View.class);%0A        when(decorView.getRootView()).thenReturn(rootView);%0A        Window window = mock(Window.class);%0A        when(window.getDecorView()).thenReturn(decorView);%0A        Activity activity = mock(Activity.class);%0A        when(activity.getResources()).thenReturn(RuntimeEnvironment.application.getResources());%0A        when(activity.getWindow()).thenReturn(window);%0A%0A        return activity;%0A    %7D%0A%0A    private int getColor(int color) %7B%0A        return RuntimeEnvironment.application.getResources().getColor(color);%0A    %7D%0A%7D%0A

Add ExpirationDateDialogThemeTest