Sean,

On Friday 05 December 2008 11:02:52 am [EMAIL PROTECTED] 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
[EMAIL PROTECTED]
http://dankulp.com/blog

Reply via email to