From 1a988f50e105c9d551327feea080e0ec10fce8a2 Mon Sep 17 00:00:00 2001 From: Iwein Fuld Date: Mon, 26 Jul 2010 11:00:41 +0000 Subject: [PATCH] QUALITY: cleaned up test case --- .../FileOutboundChannelAdapterParserTests.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java index 4795404ba8..4aa25bbb0a 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java @@ -20,7 +20,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.integration.endpoint.EventDrivenConsumer; import org.springframework.integration.file.DefaultFileNameGenerator; import org.springframework.integration.file.FileWritingMessageHandler; @@ -30,38 +29,33 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.io.File; import java.nio.charset.Charset; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.*; /** * @author Mark Fisher * @author Marius Bogoevici + * @author Iwein Fuld */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) public class FileOutboundChannelAdapterParserTests { @Autowired - @Qualifier("simpleAdapter") EventDrivenConsumer simpleAdapter; @Autowired - @Qualifier("adapterWithCustomNameGenerator") EventDrivenConsumer adapterWithCustomNameGenerator; @Autowired - @Qualifier("adapterWithDeleteFlag") EventDrivenConsumer adapterWithDeleteFlag; @Autowired - @Qualifier("adapterWithOrder") EventDrivenConsumer adapterWithOrder; @Autowired - @Qualifier("adapterWithCharset") EventDrivenConsumer adapterWithCharset; - @Test public void simpleAdapter() { DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(simpleAdapter); @@ -70,8 +64,8 @@ public class FileOutboundChannelAdapterParserTests { DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(handler); File expected = new File(System.getProperty("java.io.tmpdir")); File actual = (File) handlerAccessor.getPropertyValue("destinationDirectory"); - assertEquals(expected, actual); - assertTrue(handlerAccessor.getPropertyValue("fileNameGenerator") instanceof DefaultFileNameGenerator); + assertThat(actual, is(expected)); + assertThat(handlerAccessor.getPropertyValue("fileNameGenerator"), is(DefaultFileNameGenerator.class)); assertEquals(Boolean.FALSE, handlerAccessor.getPropertyValue("deleteSourceFiles")); }