FingerprintApiWrapper { boolean isAvailable() { return hasApis && isHardwareDetected() && hasEnrolledFingerprints(); } FingerprintApiWrapper(@NonNull Context context);   }
@Test public void isAvailable() throws Exception { TestHelper.setSdkLevel(23); when(context.checkSelfPermission(USE_FINGERPRINT)).thenReturn(PackageManager.PERMISSION_GRANTED); when(context.getSystemService(Context.FINGERPRINT_SERVICE)).thenReturn(fingerprintManager); when(fingerprintManager.hasEnrolledFingerprints()).thenReturn(true); when(fingerprintManager.isHardwareDetected()).thenReturn(true); FingerprintApiWrapper fingerprintApiWrapper = new FingerprintApiWrapper(context); assertTrue(fingerprintApiWrapper.isAvailable()); assertFalse(fingerprintApiWrapper.isUnavailable()); }