Skip to content

Commit

Permalink
Test System Rules on Windows.
Browse files Browse the repository at this point in the history
System Rules uses system dependent code that can behave different on
different OS.
  • Loading branch information
stefanbirkner committed Dec 6, 2015
1 parent 033fd51 commit eb8f080
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# System Rules

[![Build Status](https://travis-ci.org/stefanbirkner/system-rules.svg?branch=master)](https://travis-ci.org/stefanbirkner/system-rules)
[![Build Status Linux](https://travis-ci.org/stefanbirkner/system-rules.svg?branch=master)](https://travis-ci.org/stefanbirkner/system-rules) [![Build Status Windows](https://ci.appveyor.com/api/projects/status/vr0c93rssc6mhetl/branch/master?svg=true)](https://ci.appveyor.com/project/stefanbirkner/system-rules)

System Rules is a collection of JUnit rules for testing code which uses
`java.lang.System`.
Expand Down Expand Up @@ -50,9 +50,10 @@ want to contribute code than
The basic coding style is described in the
[EditorConfig](http://editorconfig.org/) file `.editorconfig`.

System Rules supports [Travis CI](https://travis-ci.org/) for continuous
integration. Your pull request will be automatically build by Travis
CI.
System Rules supports [Travis CI](https://travis-ci.org/) (Linux) and
[AppVeyor](http://www.appveyor.com/) (Windows) for continuous
integration. Your pull request will be automatically build by both CI
servers.


## Release Guide
Expand Down
20 changes: 20 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '{build}'
os: Windows Server 2012
install:
- ps: |
Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\maven" )) {
(new-object System.Net.WebClient).DownloadFile(
'http://www.us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip',
'C:\maven-bin.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven")
}
- cmd: SET PATH=C:\maven\apache-maven-3.3.9\bin;%JAVA_HOME%\bin;%PATH%
build_script:
- mvn clean package -DskipTest -Dgpg.skip
test_script:
- mvn clean verify -Dgpg.skip
cache:
- C:\maven\
- C:\Users\appveyor\.m2
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>

<artifactId>system-rules</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>System Rules</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.Locale;

import static java.lang.System.err;
import static java.lang.System.getProperty;
import static java.lang.System.setErr;
import static java.util.Locale.CANADA;
import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -268,7 +269,9 @@ public void evaluate() throws Throwable {
}, disallowWrite);
assertThat(error)
.isInstanceOf(AssertionError.class)
.hasMessage("Tried to write '\n' although this is not allowed.");
.hasMessage("Tried to write '"
+ getProperty("line.separator").substring(0, 1)
+ "' although this is not allowed.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.io.PrintStream;
import java.util.Locale;

import static java.lang.System.getProperty;
import static java.lang.System.out;
import static java.lang.System.setOut;
import static java.util.Locale.CANADA;
Expand Down Expand Up @@ -268,7 +269,9 @@ public void evaluate() throws Throwable {
}, disallowWrite);
assertThat(error)
.isInstanceOf(AssertionError.class)
.hasMessage("Tried to write '\n' although this is not allowed.");
.hasMessage("Tried to write '"
+ getProperty("line.separator").substring(0, 1)
+ "' although this is not allowed.");
}

@Test
Expand Down

0 comments on commit eb8f080

Please sign in to comment.