Commit 207d4853 authored by Dave Syer's avatar Dave Syer

More defensive testing of tmpdir

parent 0439b393
......@@ -51,7 +51,11 @@ public class LogbackLoggingSystemTests {
@Before
public void setup() {
this.logger = new SLF4JLogFactory().getInstance(getClass().getName());
new File("/tmp/spring.log").delete();
new File(tmpDir() + "/spring.log").delete();
}
private String tmpDir() {
return System.getProperty("java.io.tmpdir");
}
@After
......@@ -68,8 +72,9 @@ public class LogbackLoggingSystemTests {
this.logger.info("Hello world");
String output = this.output.toString().trim();
assertTrue("Wrong output:\n" + output, output.contains("Hello world"));
assertTrue("Wrong output:\n" + output, output.contains("/tmp/spring.log"));
assertFalse(new File("/tmp/spring.log").exists());
assertTrue("Wrong output (not " + tmpDir() + " :\n" + output,
output.contains(tmpDir() + "/tmp.log"));
assertFalse(new File(tmpDir() + "/tmp.log").exists());
}
@Test(expected = IllegalStateException.class)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment