From 22eaa649ca02df8a2550ee5b1b5577d62ac5244d Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Fri, 15 Jan 2016 13:56:40 -0500 Subject: [PATCH] Fix Jsr223InboundChannelAdapterTests Remove unnecessary assert for a null message. Poller runs every 100ms; test asserts that no message is received in 10ms Eliminate stderr: `include_class is deprecated. Use java_import.` --- .../Jsr223InboundChannelAdapterTests-context.xml | 2 +- .../jsr223/Jsr223InboundChannelAdapterTests.java | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests-context.xml b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests-context.xml index a7b15ec229..8f23e0edc2 100644 --- a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests-context.xml +++ b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests-context.xml @@ -16,7 +16,7 @@ diff --git a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests.java b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests.java index ae4ee2a24b..51f277504c 100644 --- a/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests.java +++ b/spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-2016 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. @@ -16,15 +16,14 @@ package org.springframework.integration.scripting.config.jsr223; +import static org.hamcrest.Matchers.instanceOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.util.Date; -import org.hamcrest.Matchers; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,15 +31,18 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.messaging.Message; import org.springframework.messaging.PollableChannel; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** * @author Artem Bilan + * @author Gary Russell * @since 2.0 */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) +@DirtiesContext public class Jsr223InboundChannelAdapterTests { @Autowired @@ -52,15 +54,13 @@ public class Jsr223InboundChannelAdapterTests { Message message = this.inboundChannelAdapterChannel.receive(20000); assertNotNull(message); Object payload = message.getPayload(); - assertThat(payload, Matchers.instanceOf(Date.class)); + Thread.sleep(2); + assertThat(payload, instanceOf(Date.class)); assertTrue(((Date) payload).before(new Date())); assertEquals("bar", message.getHeaders().get("foo")); message = this.inboundChannelAdapterChannel.receive(20000); assertNotNull(message); - - message = this.inboundChannelAdapterChannel.receive(10); - assertNull(message); } }