Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22c3585c authored by Aurimas Liutikas's avatar Aurimas Liutikas
Browse files

Remove uses of private Platform class in truth library.

Change-Id: I8d53ddb04fe5bccf70ef9db7bac8b37e34234ff6
Test: None
parent a24da17e
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.content.SharedPreferences;
import android.util.Pair;

import com.android.settingslib.SettingsLibRobolectricTestRunner;
import com.google.common.truth.Platform;

import org.junit.Before;
import org.junit.Test;
@@ -160,18 +159,23 @@ public class SharedPreferenceLoggerTest {
    }

    private ArgumentMatcher<Pair<Integer, Object>> pairMatches(int tag, Class clazz) {
        return pair -> pair.first == tag && Platform.isInstanceOfType(pair.second, clazz);
        return pair -> pair.first == tag && isInstanceOfType(pair.second, clazz);
    }

    private ArgumentMatcher<Pair<Integer, Object>> pairMatches(int tag, boolean bool) {
        return pair -> pair.first == tag
                && Platform.isInstanceOfType(pair.second, Integer.class)
                && isInstanceOfType(pair.second, Integer.class)
                && pair.second.equals((bool ? 1 : 0));
    }

    private ArgumentMatcher<Pair<Integer, Object>> pairMatches(int tag, int val) {
        return pair -> pair.first == tag
                && Platform.isInstanceOfType(pair.second, Integer.class)
                && isInstanceOfType(pair.second, Integer.class)
                && pair.second.equals(val);
    }

    /** Returns true if the instance is assignable to the type Clazz. */
    private static boolean isInstanceOfType(Object instance, Class<?> clazz) {
        return clazz.isInstance(instance);
    }
}