-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ | |
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.charset.Charset; | ||
import java.nio.charset.StandardCharsets; | ||
import org.cactoos.text.StringAsText; | ||
import org.hamcrest.MatcherAssert; | ||
|
@@ -34,6 +33,7 @@ | |
|
||
/** | ||
* Test case for {@link FileAsInput}. | ||
* | ||
* @author Yegor Bugayenko ([email protected]) | ||
* @version $Id$ | ||
* @since 0.1 | ||
|
@@ -42,20 +42,23 @@ public final class FileAsInputTest { | |
|
||
/** | ||
* FileAsInput can read file content. | ||
* | ||
* @throws IOException If some problem inside | ||
*/ | ||
@Test | ||
public void readsFileContent() throws IOException { | ||
final Charset utf = StandardCharsets.UTF_8; | ||
final File temp = File.createTempFile("cactoos", "txt"); | ||
temp.deleteOnExit(); | ||
MatcherAssert.assertThat( | ||
new InputAsText( | ||
new TeeInput( | ||
new TextAsInput(new StringAsText("Hello, друг!"), utf), | ||
new TextAsInput( | ||
new StringAsText("Hello, друг!"), | ||
StandardCharsets.UTF_8 | ||
), | ||
new FileAsOutput(temp) | ||
), | ||
utf | ||
StandardCharsets.UTF_8 | ||
).asString(), | ||
Matchers.allOf( | ||
Matchers.equalTo( | ||
|
@@ -66,5 +69,4 @@ public void readsFileContent() throws IOException { | |
) | ||
); | ||
} | ||
|
||
} |