cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: svn commit: r723778 - in /cxf/trunk/common/common/src: main/java/org/apache/cxf/helpers/FileUtils.java test/java/org/apache/cxf/helpers/FileUtilsTest.java
Date Fri, 05 Dec 2008 16:54:47 GMT

Sean,


On Friday 05 December 2008 11:02:52 am seanoc@apache.org wrote:
> +public class FileUtilsTest extends Assert {
> +
> +
> +    @Test
> +    public void testTempIODirExists() throws Exception {
> +
> +        try {
> +            System.setProperty("java.io.tmpdir", "dummy");
> +            FileUtils.createTempFile("foo", "bar");
> +        } catch (RuntimeException e) {
> +            assertTrue(e.toString().contains("please set java.io.tempdir
> to an existing directory")); +        }
> +    }
> +}

Most likely, you should get the original java.io.tmpdir value and restore it 
in a finally block.   I'm not sure what would happen if your test runs before 
other tests as the tmpdir value would then point to a non-existent location.   
Restoring it to the previous value should prevent any strange issues.


-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Mime
View raw message