### Question:
PersistenceOperations { @Nonnull public Single<File> defineNewShareFile(@Nonnull final Share share, @Nonnull final File directory) { checkNotNull(share, "\'share\' must not be null."); checkNotNull(directory, "\'directory\' must not be null."); return Single.just(new File(directory, format("share-%1$s", share.getIndex()))); } PersistenceOperations(
      @Nonnull final ShareSerialiser shareSerialiser,
      @Nonnull final RecoverySchemeSerialiser recoverySchemeSerialiser,
      @Nonnull final RxFiles rxFiles); @Nonnull Completable saveShareToFile(@Nonnull final Share share, @Nonnull final File file); @Nonnull Completable saveRecoverySchemeToFile(@Nonnull final RecoveryScheme recoveryScheme, @Nonnull final File file); @Nonnull Single<File> defineNewShareFile(@Nonnull final Share share, @Nonnull final File directory); @Nonnull Single<File> defineNewRecoverySchemeFile(@Nonnull final File directory); @Nonnull Single<Boolean> directoryContainsShareFiles(@Nonnull final File directory); @Nonnull Single<Boolean> directoryContainsRecoverySchemeFiles(@Nonnull final File directory);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testDefineNewShareFile_nullShare() { persistenceOperations.defineNewShareFile(null, new File("")); }
@Test(expected = IllegalArgumentException.class) public void testDefineNewShareFile_nullDirectory() { persistenceOperations.defineNewShareFile(mock(Share.class), null); }
@Test public void testDefineNewShareFile_nonNullValues() { final Share share = Share .builder() .setIndex(20) .setValue(1) .build(); final File directory = new File("test"); persistenceOperations .defineNewShareFile(share, directory) .test() .awaitDone(200, MILLISECONDS) .assertNoErrors() .assertValue(file -> file.getParentFile().equals(directory) && file.getName().equals("share-20")); }