### Question:
RxFiles { @Nonnull public Single<String> readStringFromFile(@Nonnull final File file, @Nonnull final Charset charset) { checkNotNull(file, "\'file\' must not be null."); checkNotNull(charset, "\'charset\' must not be null."); return readBytesFromFile(file).map(bytes -> new String(bytes, charset)); }  @Nonnull Completable createDirectory(@Nonnull final File directory); @Nonnull Completable createNewFile(@Nonnull final File file); @Nonnull Completable delete(@Nonnull final File file); @Nonnull Observable<File> getFilesInDirectory(@Nonnull final File directory); @Nonnull Single<String> readStringFromFile(@Nonnull final File file, @Nonnull final Charset charset); @Nonnull Completable writeStringToFile(
      @Nonnull final String data,
      @Nonnull final File file,
      @Nonnull final Charset charset); @Nonnull Single<byte[]> readBytesFromFile(@Nonnull final File file); @Nonnull Completable writeBytesToFile(@Nonnull final byte[] data, @Nonnull final File file); @Nonnull Single<Boolean> exists(@Nonnull final File file); @Nonnull Single<Long> sizeInBytes(@Nonnull final File file); @Nonnull Single<Boolean> isFile(@Nonnull final File file); @Nonnull Single<Boolean> isDirectory(@Nonnull final File directory);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testReadStringFromFile_fileIsNull() { rxFiles.readStringFromFile(null, Charset.defaultCharset()); }
@Test(expected = IllegalArgumentException.class) public void testReadStringFromFile_charsetIsNull() { rxFiles.readStringFromFile(new File(testDirectory, "test"), null); }
@Test public void testReadStringFromFile_fileIsActuallyADirectory() throws IOException { final File directory = new File(testDirectory, "test"); FileUtils.forceMkdir(directory); rxFiles .readStringFromFile(directory, Charset.defaultCharset()) .test() .awaitDone(200, MILLISECONDS) .assertError(IOException.class) .assertNoValues(); }
@Test public void testReadStringFromFile_fileDoesNotExist() { final File file = new File(testDirectory, "test.txt"); rxFiles .readStringFromFile(file, Charset.defaultCharset()) .test() .awaitDone(200, MILLISECONDS) .assertError(IOException.class) .assertNoValues(); }