### Question:
ContextCompat { @Nullable public static Drawable getDrawable(@NonNull Context context, @DrawableRes int id) { if (Build.VERSION.SDK_INT >= 21) { return context.getDrawable(id); } else if (Build.VERSION.SDK_INT >= 16) { return context.getResources().getDrawable(id); } else { final int resolvedId; synchronized (sLock) { if (sTempValue == null) { sTempValue = new TypedValue(); } context.getResources().getValue(id, sTempValue, true); resolvedId = sTempValue.resourceId; } return context.getResources().getDrawable(resolvedId); } } protected  ContextCompat(); static boolean startActivities(@NonNull Context context, @NonNull Intent[] intents); static boolean startActivities(@NonNull Context context, @NonNull Intent[] intents,
            @Nullable Bundle options); static void startActivity(@NonNull Context context, @NonNull Intent intent,
            @Nullable Bundle options); @Nullable static File getDataDir(@NonNull Context context); @NonNull static File[] getObbDirs(@NonNull Context context); @NonNull static File[] getExternalFilesDirs(@NonNull Context context, @Nullable String type); @NonNull static File[] getExternalCacheDirs(@NonNull Context context); @Nullable static Drawable getDrawable(@NonNull Context context, @DrawableRes int id); @Nullable static ColorStateList getColorStateList(@NonNull Context context,
            @ColorRes int id); @ColorInt static int getColor(@NonNull Context context, @ColorRes int id); static int checkSelfPermission(@NonNull Context context, @NonNull String permission); @Nullable static File getNoBackupFilesDir(@NonNull Context context); static File getCodeCacheDir(@NonNull Context context); @Nullable static Context createDeviceProtectedStorageContext(@NonNull Context context); static boolean isDeviceProtectedStorage(@NonNull Context context); static void startForegroundService(@NonNull Context context, @NonNull Intent intent); @SuppressWarnings("unchecked") @Nullable static T getSystemService(@NonNull Context context, @NonNull Class<T> serviceClass); @Nullable static String getSystemServiceName(@NonNull Context context,
            @NonNull Class<?> serviceClass);  }### Answer:
@Test public void testGetDrawable() throws Throwable { Drawable unthemedDrawable = ContextCompat.getDrawable(mContext, R.drawable.test_drawable_red); TestUtils.assertAllPixelsOfColor("Unthemed drawable load", unthemedDrawable, mContext.getResources().getColor(R.color.test_red)); if (Build.VERSION.SDK_INT >= 23) { Drawable themedYellowDrawable = ContextCompat.getDrawable(mContext, R.drawable.themed_drawable); TestUtils.assertAllPixelsOfColor("Themed yellow drawable load", themedYellowDrawable, 0xFFF0B000); } }
@Test public void testDrawableConfigurationWorkaround() throws Throwable { final int expectedWidth = scaleFromDensity(7, DisplayMetrics.DENSITY_LOW, mContext.getResources().getDisplayMetrics().densityDpi); Drawable referencedDrawable = ContextCompat.getDrawable(mContext, R.drawable.aliased_drawable); assertEquals("Drawable configuration does not match DisplayMetrics", expectedWidth, referencedDrawable.getIntrinsicWidth()); }