RxFingerprint { @SuppressWarnings("MissingPermission") public static boolean isHardwareDetected(@NonNull Context context) { return new FingerprintApiWrapper(context).isHardwareDetected(); }  static Observable<FingerprintAuthenticationResult> authenticate(@NonNull Context context); static Observable<FingerprintEncryptionResult> encrypt(@NonNull Context context, @NonNull String toEncrypt); static Observable<FingerprintEncryptionResult> encrypt(@NonNull Context context, @NonNull String toEncrypt, boolean keyInvalidatedByBiometricEnrollment); static Observable<FingerprintEncryptionResult> encrypt(@NonNull Context context, @NonNull char[] toEncrypt, boolean keyInvalidatedByBiometricEnrollment); static Observable<FingerprintDecryptionResult> decrypt(@NonNull Context context, @NonNull String encrypted); static Observable<FingerprintEncryptionResult> encrypt(@NonNull Context context, @Nullable String keyName, @NonNull String toEncrypt); static Observable<FingerprintEncryptionResult> encrypt(@NonNull Context context, @Nullable String keyName, @NonNull char[] toEncrypt); static Observable<FingerprintDecryptionResult> decrypt(@NonNull Context context, @Nullable String keyName, @NonNull String encrypted); static Observable<FingerprintEncryptionResult> encrypt(@NonNull EncryptionMethod method,
																  @NonNull Context context,
																  @Nullable String keyName,
																  @NonNull String toEncrypt); static Observable<FingerprintEncryptionResult> encrypt(@NonNull EncryptionMethod method,
																																@NonNull Context context,
																																@Nullable String keyName,
																																@NonNull char[] toEncrypt); static Observable<FingerprintEncryptionResult> encrypt(@NonNull EncryptionMethod method,
																  @NonNull Context context,
																  @Nullable String keyName,
																  @NonNull String toEncrypt,
																  boolean keyInvalidatedByBiometricEnrollment); static Observable<FingerprintEncryptionResult> encrypt(@NonNull EncryptionMethod method,
																																@NonNull Context context,
																																@Nullable String keyName,
																																@NonNull char[] toEncrypt,
																																boolean keyInvalidatedByBiometricEnrollment); static Observable<FingerprintDecryptionResult> decrypt(@NonNull EncryptionMethod method,
																  @NonNull Context context,
																  @Nullable String keyName,
																  @NonNull String toDecrypt); static boolean isAvailable(@NonNull Context context); static boolean isUnavailable(@NonNull Context context); @SuppressWarnings("MissingPermission") static boolean isHardwareDetected(@NonNull Context context); @SuppressWarnings("MissingPermission") static boolean hasEnrolledFingerprints(@NonNull Context context); static void setLogger(@NonNull RxFingerprintLogger logger); static void disableLogging(); static boolean keyInvalidated(Throwable throwable);  }
@Test public void hardwareAvailable() throws Exception { when(mockContext.getSystemService(Context.FINGERPRINT_SERVICE)).thenReturn(mockFingerprintManager); when(mockFingerprintManager.isHardwareDetected()).thenReturn(true); assertTrue("Hardware should be available", RxFingerprint.isHardwareDetected(mockContext)); }
@Test public void hardwareUnavailable() throws Exception { when(mockContext.getSystemService(Context.FINGERPRINT_SERVICE)).thenReturn(mockFingerprintManager); when(mockFingerprintManager.isHardwareDetected()).thenReturn(false); assertFalse("Hardware should not be available", RxFingerprint.isHardwareDetected(mockContext)); }