diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java index 4d0ed5fcd5..eabbfa0827 100644 --- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java +++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** * @author Iwein Fuld + * @author Mark Fisher */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) @@ -47,20 +48,24 @@ public class FileInboundChannelAdapterParserTests { FileReadingMessageSource source; DirectFieldAccessor accessor; - - @Before public void init(){ - accessor= new DirectFieldAccessor(source); + + + @Before public void init() { + accessor = new DirectFieldAccessor(source); } - + + @Test public void channelName() throws Exception { MessageChannel channel = (MessageChannel) context.getBean("inputDirPoller"); - assertEquals("Channel should be available under specified id","inputDirPoller", channel.getName()); + assertEquals("Channel should be available under specified id", "inputDirPoller", channel.getName()); } - + @Test public void inputDirectory() { - assertEquals("'inputDirectory' should be set",System.getProperty("java.io.tmpdir"), ((File) accessor.getPropertyValue("inputDirectory")).getPath()); + File expected = new File(System.getProperty("java.io.tmpdir")); + File actual = (File) accessor.getPropertyValue("inputDirectory"); + assertEquals("'inputDirectory' should be set", expected, actual); } @Test diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithPatternParserTests.java b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithPatternParserTests.java index 60ccf3832a..d09e2aa79b 100644 --- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithPatternParserTests.java +++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileInboundChannelAdapterWithPatternParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,7 +79,9 @@ public class FileInboundChannelAdapterWithPatternParserTests { @Test public void inputDirectory() { - assertEquals(System.getProperty("java.io.tmpdir"), ((File) accessor.getPropertyValue("inputDirectory")).getPath()); + File expected = new File(System.getProperty("java.io.tmpdir")); + File actual = (File) accessor.getPropertyValue("inputDirectory"); + assertEquals(expected, actual); } @Test diff --git a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java index c96d23a324..1fe25a0e36 100644 --- a/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java +++ b/org.springframework.integration.file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,8 +56,9 @@ public class FileOutboundChannelAdapterParserTests { FileWritingMessageHandler handler = (FileWritingMessageHandler) adapterAccessor.getPropertyValue("handler"); DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler); - assertEquals(System.getProperty("java.io.tmpdir"), - ((File) handlerAccessor.getPropertyValue("parentDirectory")).getAbsolutePath()); + File expected = new File(System.getProperty("java.io.tmpdir")); + File actual = (File) handlerAccessor.getPropertyValue("parentDirectory"); + assertEquals(expected, actual); assertTrue(handlerAccessor.getPropertyValue("fileNameGenerator") instanceof DefaultFileNameGenerator); } @@ -67,8 +68,9 @@ public class FileOutboundChannelAdapterParserTests { FileWritingMessageHandler handler = (FileWritingMessageHandler) adapterAccessor.getPropertyValue("handler"); DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler); - assertEquals(System.getProperty("java.io.tmpdir"), - ((File) handlerAccessor.getPropertyValue("parentDirectory")).getAbsolutePath()); + File expected = new File(System.getProperty("java.io.tmpdir")); + File actual = (File) handlerAccessor.getPropertyValue("parentDirectory"); + assertEquals(expected, actual); assertTrue(handlerAccessor.getPropertyValue("fileNameGenerator") instanceof CustomFileNameGenerator); }