@@ -0,0 +1,3407 @@
+package com.github.ajalt.reprint.core.module.marshmallow;%0A%0Aimport android.content.Context;%0Aimport android.hardware.fingerprint.FingerprintManager;%0Aimport android.os.Build;%0Aimport android.support.annotation.Nullable;%0Aimport android.support.annotation.RequiresApi;%0Aimport android.support.v4.os.CancellationSignal;%0A%0Aimport com.github.ajalt.reprint.core.AuthenticationListener;%0Aimport com.github.ajalt.reprint.core.Reprint;%0Aimport com.github.ajalt.reprint.module.marshmallow.MarshmallowReprintModule;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.ArgumentCaptor;%0Aimport org.mockito.Captor;%0Aimport org.mockito.Mock;%0Aimport org.mockito.junit.MockitoJUnitRunner;%0A%0Aimport static org.assertj.core.api.Java6Assertions.assertThat;%0Aimport static org.mockito.ArgumentMatchers.any;%0Aimport static org.mockito.Mockito.when;%0A%0A@RequiresApi(api = Build.VERSION_CODES.M)%0A@SuppressWarnings(%22MissingPermission%22)%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class MarshmallowReprintModuleTest %7B%0A    private static final Reprint.Logger LOGGER = new Reprint.Logger() %7B%0A        public void log(String message) %7B%0A            System.out.println(message);%0A        %7D%0A%0A        public void logException(Throwable throwable, String message) %7B%0A            System.out.println(message);%0A            System.out.printf(%22%25s %25s%25n%22, throwable.toString(), throwable.getMessage());%0A        %7D%0A    %7D;%0A%0A    public MarshmallowReprintModule module;%0A    @Mock public Context context;%0A    @Mock public FingerprintManager fingerprintManager;%0A%0A    @Before%0A    public void setup() %7B%0A        when(context.getApplicationContext()).thenReturn(context);%0A        module = new MarshmallowReprintModule(context, LOGGER);%0A    %7D%0A%0A    private void setupValidManager() %7B%0A        setupManager(this.fingerprintManager);%0A        when(fingerprintManager.isHardwareDetected()).thenReturn(true);%0A        when(fingerprintManager.hasEnrolledFingerprints()).thenReturn(true);%0A    %7D%0A%0A    private void setupManager(@Nullable FingerprintManager fingerprintManager) %7B%0A        when(context.getSystemService(any(Class.class))).thenReturn(fingerprintManager);%0A    %7D%0A%0A    @Test%0A    public void fingerprintManager_null() throws Exception %7B%0A        setupManager(null);%0A        assertThat(module.isHardwarePresent()).isFalse();%0A        assertThat(module.hasFingerprintRegistered()).isFalse();%0A    %7D%0A%0A    @Test%0A    public void fingerprintManager_noHardware() throws Exception %7B%0A        setupManager(fingerprintManager);%0A        when(fingerprintManager.isHardwareDetected()).thenReturn(false);%0A        when(fingerprintManager.hasEnrolledFingerprints()).thenReturn(false);%0A        assertThat(module.isHardwarePresent()).isFalse();%0A        assertThat(module.hasFingerprintRegistered()).isFalse();%0A    %7D%0A%0A    @Test%0A    public void fingerprintManager_noFingerprints() throws Exception %7B%0A        setupManager(fingerprintManager);%0A        when(fingerprintManager.isHardwareDetected()).thenReturn(true);%0A        when(fingerprintManager.hasEnrolledFingerprints()).thenReturn(false);%0A        assertThat(module.isHardwarePresent()).isTrue();%0A        assertThat(module.hasFingerprintRegistered()).isFalse();%0A    %7D%0A%0A    @Test%0A    public void fingerprintManager_fingerprints() throws Exception %7B%0A        setupValidManager();%0A        assertThat(module.isHardwarePresent()).isTrue();%0A        assertThat(module.hasFingerprintRegistered()).isTrue();%0A    %7D%0A%7D%0A

Add MarshmallowReprintModuleTest