diff --git a/core-java-modules/core-java-io-apis-2/pom.xml b/core-java-modules/core-java-io-apis-2/pom.xml
index dc33e5338a..410c164496 100644
--- a/core-java-modules/core-java-io-apis-2/pom.xml
+++ b/core-java-modules/core-java-io-apis-2/pom.xml
@@ -96,4 +96,5 @@
5.9.3
-
\ No newline at end of file
+
+
diff --git a/core-java-modules/core-java-io-apis-2/src/test/java/com/baeldung/inputstreamreader/InputStreamReaderUnitTest.java b/core-java-modules/core-java-io-apis-2/src/test/java/com/baeldung/inputstreamreader/InputStreamReaderUnitTest.java
new file mode 100644
index 0000000000..d67b56e10b
--- /dev/null
+++ b/core-java-modules/core-java-io-apis-2/src/test/java/com/baeldung/inputstreamreader/InputStreamReaderUnitTest.java
@@ -0,0 +1,39 @@
+package com.baeldung.inputstreamreader;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+public class InputStreamReaderUnitTest {
+ @Test
+ public void givenAStringWrittenToAFile_whenReadByInputStreamReader_thenShouldMatchWhenRead(@TempDir Path tempDir) throws IOException {
+ String sampleTxt = "Good day. This is just a test. Good bye.";
+ Path sampleOut = tempDir.resolve("sample-out.txt");
+ List lines = Arrays.asList(sampleTxt);
+ Files.write(sampleOut, lines);
+ String absolutePath = String.valueOf(sampleOut.toAbsolutePath());
+ try (InputStreamReader reader = new InputStreamReader(new FileInputStream(absolutePath), StandardCharsets.UTF_8)) {
+ boolean isMatched = false;
+ int b;
+ StringBuilder sb = new StringBuilder();
+ while ((b = reader.read()) != -1) {
+ sb.append((char) b);
+ if (sb.toString().contains(sampleTxt)) {
+ isMatched = true;
+ break;
+ }
+ }
+ assertThat(isMatched).isTrue();
+ }
+ }
+}