From 838b783517b46fa45273d976ad1e1237506a97af Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Thu, 28 Oct 2010 11:50:56 -0400 Subject: [PATCH] INT-1471, more polishing, pushing tests that I worgot to 'git add' --- ...estSendingMessageHandlerParser-context.xml | 32 ++++++++++ .../TestSendingMessageHandlerParserTests.java | 60 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParser-context.xml create mode 100644 spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParserTests.java diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParser-context.xml b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParser-context.xml new file mode 100644 index 0000000000..2a7d551034 --- /dev/null +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParser-context.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParserTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParserTests.java new file mode 100644 index 0000000000..42943c92b8 --- /dev/null +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingMessageHandlerParserTests.java @@ -0,0 +1,60 @@ +/* + * 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.twitter.config; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.junit.Test; +import org.springframework.beans.factory.FactoryBean; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.twitter.oauth.OAuthConfiguration; + +import twitter4j.Twitter; + +/** + * @author Oleg Zhurakousky + * + */ +public class TestSendingMessageHandlerParserTests { + + @Test + public void testSendingMessageHandlerSuccessfullBootstrap(){ + new ClassPathXmlApplicationContext("TestSendingMessageHandlerParser-context.xml", this.getClass()); + // the fact that no exception was thrown satisfies this test + } + + public static class MockOathConfigurationFactoryBean implements FactoryBean{ + + @Override + public OAuthConfiguration getObject() throws Exception { + OAuthConfiguration config = mock(OAuthConfiguration.class); + Twitter twitter = mock(Twitter.class); + when(config.getTwitter()).thenReturn(twitter); + return config; + } + + @Override + public Class getObjectType() { + return OAuthConfiguration.class; + } + + @Override + public boolean isSingleton() { + return true; + } + } +}