INT-2916 - Upgrade to JUnit 4.11 in support of JDK7
For reference see: https://jira.springsource.org/browse/INT-2916 Changes: * INT-2919 - Upgrade Spring Data Gemfire to 1.2.2.RELEASE * Exclude Hamcrest transitive dependency from JUnit (as already explicitly declared) * Set sourceCompatibility in build.gradle to 1.6 * Set targetCompatibility in build.gradle to 1.6 * Upgrade Hamcrest to 1.3 and fix deprications - Corematcher is(*class) change to is(instanceOf(*class)) - Change org.junit.internal.matchers.TypeSafeMatcher to org.hamcrest.TypeSafeMatcher - Change import org.junit.matchers.JUnitMatchers.containsString to org.hamcrest.CoreMatchers.containsString - Change import org.junit.matchers.JUnitMatchers.both to org.hamcrest.CoreMatchers.both - Change import org.junit.matchers.JUnitMatchers.containsString to org.hamcrest.CoreMatchers.containsString * Fix JUnit deprecations - changed junit.framework.Assert to org.junit.Assert * Add few missing licenses headers to tests * Marked several test classes with: @DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) - SplitterIntegrationTests - GatewayInvokingMessageHandlerTests - FileToChannelIntegrationTests - FileInboundChannelAdapterWithRecursiveDirectoryTests - JdbcMessageStoreChannelTests - ChatMessageInboundChannelAdapterParserTests * 3 Tests ignored (Still needs to be addressed): - testOperationOnPrototypeBean - testFailOperationWithCustomScope - testOperationOfControlBus * Update SQL script (test-failure): - spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/outboundSchema.sql - add drop table statements - add ignore-failures="DROPS" to "jdbcOutboundChannelAdapterCommonConfig.xml" INT-2916 - Code Review Changes INT-2916 - Fix ignored Tests Fix 3 previously ignored tests in *GroovyControlBusTests*: * testOperationOnPrototypeBean * testFailOperationWithCustomScope * testOperationOfControlBus INT-2916 - CI Build Testing INT-2963 - Remove JDK7 Compilation Warnings * Upgrade Mockito to 1.9.5 * Fix failing SubscribableJmsChannelTests INT-2916 - Standardize Hamcrest assertions Ensure Hamcrest assertions are standardized to: is(instanceOf(...))
This commit is contained in:
committed by
Gary Russell
parent
3c98b371fa
commit
0271acaf4c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2013 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,7 +16,7 @@
|
||||
|
||||
package org.springframework.integration.mail.config;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.Properties;
|
||||
@@ -38,6 +38,7 @@ import org.springframework.mail.MailSender;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
public class MailOutboundChannelAdapterParserTests {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.integration.mail.config;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -58,24 +58,24 @@ public class MessageWithContentTypeTests {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("MessageWithContentTypeTests-context.xml", this.getClass());
|
||||
MessageChannel inputChannel = ac.getBean("inputChannel", MessageChannel.class);
|
||||
StringWriter writer = new StringWriter();
|
||||
FileReader reader = new FileReader("src/test/java/org/springframework/integration/mail/config/test.html");
|
||||
FileReader reader = new FileReader("src/test/java/org/springframework/integration/mail/config/test.html");
|
||||
FileCopyUtils.copy(reader, writer);
|
||||
inputChannel.send(new GenericMessage<String>(writer.getBuffer().toString()));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testMessageConversionWithHtmlAndContentType() throws Exception{
|
||||
JavaMailSender sender = mock(JavaMailSender.class);
|
||||
MailSendingMessageHandler handler = new MailSendingMessageHandler(sender);
|
||||
StringWriter writer = new StringWriter();
|
||||
FileReader reader = new FileReader("src/test/java/org/springframework/integration/mail/config/test.html");
|
||||
FileReader reader = new FileReader("src/test/java/org/springframework/integration/mail/config/test.html");
|
||||
FileCopyUtils.copy(reader, writer);
|
||||
Message<String> message = MessageBuilder.withPayload(writer.getBuffer().toString())
|
||||
.setHeader(MailHeaders.TO, "to")
|
||||
.setHeader(MailHeaders.FROM, "from")
|
||||
.setHeader(MailHeaders.CONTENT_TYPE, "text/html")
|
||||
.build();
|
||||
MimeMessage mMessage = new TestMimeMessage();
|
||||
MimeMessage mMessage = new TestMimeMessage();
|
||||
// MOCKS
|
||||
when(sender.createMimeMessage()).thenReturn(mMessage);
|
||||
doAnswer(new Answer<Object>() {
|
||||
@@ -85,16 +85,16 @@ public class MessageWithContentTypeTests {
|
||||
return null;
|
||||
}
|
||||
}).when(sender).send(Mockito.any(MimeMessage.class));
|
||||
|
||||
|
||||
// handle message
|
||||
handler.handleMessage(message);
|
||||
|
||||
|
||||
verify(sender, times(1)).send(Mockito.any(MimeMessage.class));
|
||||
}
|
||||
|
||||
|
||||
private static class TestMimeMessage extends MimeMessage{
|
||||
public TestMimeMessage() {
|
||||
super(Session.getDefaultInstance(new Properties()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user