INT-1301 MessagingTemplate methods now return void instead of boolean, but they throw Exceptions if the underlying channel send() invocation returns false.

This commit is contained in:
Mark Fisher
2010-07-29 21:14:24 +00:00
parent 00d1713981
commit 164023c8bc
13 changed files with 76 additions and 61 deletions

View File

@@ -16,12 +16,15 @@
package org.springframework.integration.aggregator;
import static org.mockito.Mockito.isA;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.Test;
import org.springframework.integration.Message;
import org.springframework.integration.core.MessageBuilder;
import org.springframework.integration.core.MessageChannel;
@@ -40,6 +43,7 @@ public class CorrelatingMessageHandlerIntegrationTests {
@Before
public void setupHandler() {
when(outputChannel.send(isA(Message.class))).thenReturn(true);
defaultHandler.setOutputChannel(outputChannel);
defaultHandler.setSendTimeout(-1);
}

View File

@@ -1,6 +1,23 @@
/*
* Copyright 2002-2010 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.aggregator;
import static org.junit.matchers.JUnitMatchers.hasItems;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -48,6 +65,7 @@ public class ExpressionEvaluatingMessageGroupProcessorTests {
@Before
public void setup() {
when(outputChannel.send(isA(Message.class))).thenReturn(true);
messages.clear();
for (int i = 0; i < 5; i++) {
messages.add(MessageBuilder.withPayload(i + 1).setHeader("foo", "bar").build());