Skip to content

Commit

Permalink
Merge #815 "Additional unit-tests for #789". Update History.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
brasmusson committed Mar 18, 2015
2 parents 77884d4 + cfc60cb commit 950172a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [1.2.3-SNAPSHOT](https://github.com/cucumber/cucumber-jvm/compare/v1.2.2...master) (In Git)

* [Core] Additional unit-tests for [#789](https://github.com/cucumber/cucumber-jvm/issues/789) ([#815](https://github.com/cucumber/cucumber-jvm/pull/815) Klaus Bayrhammer)
* [Java] Added @Documented to all step annotations ([#834](https://github.com/cucumber/cucumber-jvm/pull/834), [#833](https://github.com/cucumber/cucumber-jvm/issues/833) Peter Oxenham)
* [Core] Set a description for Scenario Outline scenarios ([#841](https://github.com/cucumber/cucumber-jvm/pull/841), [#837](https://github.com/cucumber/cucumber-jvm/issues/837) Björn Rasmusson)
* [Core] Call all formatters, also in case of unimplemented methods ([#842](https://github.com/cucumber/cucumber-jvm/pull/842), [#803](https://github.com/cucumber/cucumber-jvm/issues/803) Björn Rasmusson)
Expand Down
18 changes: 13 additions & 5 deletions core/src/test/java/cucumber/runtime/io/URLOutputStreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
import java.io.Writer;
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
Expand All @@ -47,16 +50,21 @@ public void stopWebbit() throws ExecutionException, InterruptedException {
}

@Test
public void can_write_to_file() throws IOException {
File tmp = File.createTempFile("cucumber-jvm", "tmp");
Writer w = new UTF8OutputStreamWriter(new URLOutputStream(tmp.toURI().toURL()));
public void write_to_file_without_existing_parent_directory() throws IOException, URISyntaxException {
Path filesWithoutParent = Files.createTempDirectory("filesWithoutParent");
String baseURL = filesWithoutParent.toUri().toURL().toString();
URL urlWithoutParentDirectory = new URL(baseURL + "/non/existing/directory");

Writer w = new UTF8OutputStreamWriter(new URLOutputStream(urlWithoutParentDirectory));
w.write("Hellesøy");
w.close();
assertEquals("Hellesøy", FixJava.readReader(openUTF8FileReader(tmp)));

File testFile = new File(urlWithoutParentDirectory.toURI());
assertEquals("Hellesøy", FixJava.readReader(openUTF8FileReader(testFile)));
}

@Test
public void can_write_to_file_using_path() throws IOException {
public void can_write_to_file() throws IOException {
File tmp = File.createTempFile("cucumber-jvm", "tmp");
Writer w = new UTF8OutputStreamWriter(new URLOutputStream(tmp.toURI().toURL()));
w.write("Hellesøy");
Expand Down

0 comments on commit 950172a

Please sign in to comment.