You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/08/24 03:46:59 UTC
[34/38] james-project git commit: JAMES-2114 Remove some tests
targeting the logging system
JAMES-2114 Remove some tests targeting the logging system
It breaks our testing policy concerning logs. Such tests should just ensure we do not fail
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/0fb81ac2
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/0fb81ac2
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/0fb81ac2
Branch: refs/heads/master
Commit: 0fb81ac2178ec2971df583f4b70cb64dcf5d6069
Parents: d56d0b1
Author: benwa <bt...@linagora.com>
Authored: Tue Aug 15 15:04:09 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Thu Aug 24 10:34:44 2017 +0700
----------------------------------------------------------------------
.../mailets/AmqpForwardAttributeTest.java | 15 ++++--------
.../transport/mailets/ToProcessorTest.java | 24 --------------------
2 files changed, 4 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/0fb81ac2/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
index dac1fab..0af1e67 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
@@ -20,7 +20,6 @@
package org.apache.james.transport.mailets;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@@ -184,33 +183,27 @@ public class AmqpForwardAttributeTest {
}
@Test
- public void serviceShouldLogWhenTimeoutException() throws Exception {
+ public void serviceShouldNotFailWhenTimeoutException() throws Exception {
mailet.init(mailetConfig);
Mail mail = mock(Mail.class);
when(mail.getAttribute(MAIL_ATTRIBUTE)).thenReturn(ATTRIBUTE_CONTENT);
ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
- TimeoutException expectedLoggedException = new TimeoutException();
- when(connectionFactory.newConnection()).thenThrow(expectedLoggedException);
+ when(connectionFactory.newConnection()).thenThrow(new TimeoutException());
mailet.setConnectionFactory(connectionFactory);
mailet.service(mail);
-
- verify(logger).error(any(String.class), eq(expectedLoggedException));
}
@Test
- public void serviceShouldLogWhenIOException() throws Exception {
+ public void serviceShouldNotFailWhenIOException() throws Exception {
mailet.init(mailetConfig);
Mail mail = mock(Mail.class);
when(mail.getAttribute(MAIL_ATTRIBUTE)).thenReturn(ATTRIBUTE_CONTENT);
ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
- IOException expectedLoggedException = new IOException();
- when(connectionFactory.newConnection()).thenThrow(expectedLoggedException);
+ when(connectionFactory.newConnection()).thenThrow(new IOException());
mailet.setConnectionFactory(connectionFactory);
mailet.service(mail);
-
- verify(logger).error(any(String.class), eq(expectedLoggedException));
}
@Test
http://git-wip-us.apache.org/repos/asf/james-project/blob/0fb81ac2/mailet/standard/src/test/java/org/apache/james/transport/mailets/ToProcessorTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/ToProcessorTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/ToProcessorTest.java
index 35175a5..233d909 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/ToProcessorTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/ToProcessorTest.java
@@ -21,9 +21,7 @@
package org.apache.james.transport.mailets;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
import javax.mail.MessagingException;
@@ -31,7 +29,6 @@ import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.Mailet;
import org.apache.mailet.MailetException;
-import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailContext;
import org.apache.mailet.base.test.FakeMailetConfig;
@@ -133,25 +130,4 @@ public class ToProcessorTest {
assertThat(mail.getErrorMessage()).isEqualTo(initialErrorMessage + "\r\n" + notice);
}
-
- @Test
- public void serviceShouldLogWhenDebug() throws MessagingException {
- FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
- .mailetName("Test")
- .mailetContext(mailContext)
- .setProperty("processor", "error")
- .setProperty("notice", "error in message")
- .setProperty("debug", "true")
- .build();
- mailet.init(mailetConfig);
-
- String initialErrorMessage = "first";
- Mail mail = FakeMail.builder()
- .recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES)
- .errorMessage(initialErrorMessage)
- .build();
- mailet.service(mail);
-
- verify(logger).info(anyString());
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org