/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.support.v7.widget;

import org.junit.Test;

import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.support.v7.appcompat.test.R;
import android.support.v7.testutils.TestUtils;
import android.widget.ImageView;

import static org.junit.Assert.assertTrue;

/**
 * In addition to all tinting-related tests done by the base class, this class provides
 * tests specific to {@link AppCompatImageView} class.
 */
public class AppCompatImageViewTest
        extends AppCompatBaseViewTest<AppCompatImageViewActivity, AppCompatImageView> {
    public AppCompatImageViewTest() {
        super(AppCompatImageViewActivity.class);
    }

    @Test
    public void testImageViewBothSrcCompatAndroidSrcSet() {
        final int expectedColor = mContainer.getResources().getColor(R.color.test_blue);

        final ImageView view = (ImageView) mContainer.findViewById(R.id.view_android_src_srccompat);
        final Drawable drawable = view.getDrawable();

        TestUtils.assertAllPixelsOfColor("ImageView drawable should be blue",
                drawable, view.getWidth(), view.getHeight(), true,
                expectedColor, 0, false);
    }
}

@@ -660,40 +660,84 @@
 ort 
-org.junit.T
+static android.support.t
 est
+.espresso.Espresso.onView
 ;%0A
-%0A
 import 
+static 
 android.
 grap
@@ -736,40 +736,132 @@
 oid.
-graphics.drawable.ColorDrawable;
+support.test.espresso.assertion.ViewAssertions.matches;%0Aimport static android.support.test.espresso.matcher.ViewMatchers.*;%0A
 %0Aimp
@@ -900,16 +900,70 @@
 awable;%0A
+import android.support.test.espresso.ViewInteraction;%0A
 import a
@@ -1043,16 +1043,24 @@
 estUtils
+Matchers
 ;%0Aimport
@@ -1094,23 +1094,16 @@
 %0Aimport 
-static 
 org.juni
@@ -1108,25 +1108,12 @@
 nit.
-Assert.assertTrue
+Test
 ;%0A%0A/
@@ -1639,25 +1639,24 @@
 _blue);%0A
-%0A
         
 final Im
@@ -1651,64 +1651,57 @@
     
-final ImageView view = (ImageView) mContainer.findViewBy
+ViewInteraction imageViewInteration = onView(with
 Id(R
@@ -1731,16 +1731,17 @@
 ccompat)
+)
 ;%0A      
@@ -1746,216 +1746,69 @@
     
-final Drawable drawable = view.getDrawable();%0A%0A        TestUtils.assertAllPixelsOfColor(%22ImageView drawable should be blue%22,%0A                drawable, view.getWidth(), view.getHeight(), true,%0A                
+imageViewInteration.check(matches(TestUtilsMatchers.drawable(
 expe
@@ -1820,18 +1820,10 @@
 olor
-, 0, false
+))
 );%0A 

Fix AppCompatImageViewTest test.