new test
This commit is contained in:
parent
4fec9286e8
commit
58bf2bf3ea
|
@ -1,2 +0,0 @@
|
||||||
line 1
|
|
||||||
a second line
|
|
|
@ -19,6 +19,7 @@ import java.io.Reader;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
@ -191,6 +192,16 @@ public class JavaInputStreamToXUnitTest {
|
||||||
IOUtils.closeQuietly(outStream);
|
IOUtils.closeQuietly(outStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public final void givenUsingPlainJava8_whenConvertingAnInProgressInputStreamToAFile_thenCorrect() throws IOException {
|
||||||
|
final InputStream initialStream = new FileInputStream(new File("src/main/resources/sample.txt"));
|
||||||
|
final File targetFile = new File("src/main/resources/targetFile.tmp");
|
||||||
|
|
||||||
|
java.nio.file.Files.copy(initialStream, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
|
||||||
|
IOUtils.closeQuietly(initialStream);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public final void givenUsingGuava_whenConvertingAnInputStreamToAFile_thenCorrect() throws IOException {
|
public final void givenUsingGuava_whenConvertingAnInputStreamToAFile_thenCorrect() throws IOException {
|
||||||
final InputStream initialStream = new FileInputStream(new File("src/main/resources/sample.txt"));
|
final InputStream initialStream = new FileInputStream(new File("src/main/resources/sample.txt"));
|
||||||
|
|
Loading…
Reference in New Issue