  @Test public void readThrowsOnSubscribeWhenCannotStoreSecurely() {

    shadowContext.grantPermissions(USE_FINGERPRINT);
    when(fingerprintManager.isHardwareDetected()).thenReturn(true);
    when(fingerprintManager.hasEnrolledFingerprints()).thenReturn(true);

    Observable<ReadResult> read = whorlwind.read("a");
    shadowContext.denyPermissions(USE_FINGERPRINT);

    try {
      read.blockingForEach(new Consumer<ReadResult>() {
        @Override public void accept(ReadResult readResult) throws Exception {
          fail();
        }
      });
      fail();
    } catch (IllegalStateException expected) {
      assertThat(expected).hasMessage(
          "Can't store securely. Check canStoreSecurely() before attempting to read/write.");
    }

    verifyZeroInteractions(storage);
  }