This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 59410aba6fc72fb6546680797abfb8190d3fdd7d Author: Benoit Tellier <[email protected]> AuthorDate: Tue Mar 5 11:20:04 2019 +0700 JAMES-2665 MailImplTest: solve intelliJ warnings - public classifier are not needed - remove needless exceptions - Replace all thrown exception declaration by Exception --- .../org/apache/james/server/core/MailImplTest.java | 52 +++++++++++----------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/server/container/core/src/test/java/org/apache/james/server/core/MailImplTest.java b/server/container/core/src/test/java/org/apache/james/server/core/MailImplTest.java index 675eb29..b32de20 100644 --- a/server/container/core/src/test/java/org/apache/james/server/core/MailImplTest.java +++ b/server/container/core/src/test/java/org/apache/james/server/core/MailImplTest.java @@ -51,14 +51,14 @@ public class MailImplTest extends ContractMailTest { private MimeMessage emptyMessage; @BeforeEach - public void setup() throws MessagingException { + void setup() throws MessagingException { emptyMessage = MimeMessageBuilder.mimeMessageBuilder() .setText("") .build(); } @Test - public void mailImplShouldHaveSensibleInitialValues() throws MessagingException { + void mailImplShouldHaveSensibleInitialValues() throws MessagingException { MailImpl mail = newMail(); assertThat(mail.getName()).isEqualTo("mail-id"); @@ -74,14 +74,14 @@ public class MailImplTest extends ContractMailTest { } @Test - public void mailImplShouldThrowWhenComputingSizeOnDefaultInstance() throws MessagingException { + void mailImplShouldThrowWhenComputingSizeOnDefaultInstance() { MailImpl mail = newMail(); assertThatThrownBy(mail::getMessageSize).isInstanceOf(NullPointerException.class); } @Test - public void mailImplConstructionShouldSetDefaultValuesOnUnspecifiedFields() throws MessagingException { + void mailImplConstructionShouldSetDefaultValuesOnUnspecifiedFields() throws MessagingException { MailImpl mail = MailImpl.builder() .name(MailUtil.newId()) .sender("sender@localhost") @@ -93,7 +93,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void mailImplConstructionShouldSetSpecifiedFields() throws MessagingException { + void mailImplConstructionShouldSetSpecifiedFields() throws MessagingException { String sender = "sender@localhost"; String name = MailUtil.newId(); MailImpl mail = MailImpl.builder() @@ -107,7 +107,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void mailImplConstructionWithMimeMessageShouldSetSpecifiedFields() throws MessagingException { + void mailImplConstructionWithMimeMessageShouldSetSpecifiedFields() throws MessagingException { String name = MailUtil.newId(); String sender = "sender@localhost"; @@ -127,7 +127,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void mailImplConstructionWithMimeMessageShouldNotOverwriteMessageId() throws MessagingException { + void mailImplConstructionWithMimeMessageShouldNotOverwriteMessageId() throws MessagingException { MailImpl mail = MailImpl.builder() .name(MailUtil.newId()) .sender("sender@localhost") @@ -138,7 +138,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void duplicateFactoryMethodShouldGenerateNewObjectWithSameValuesButName() throws MessagingException, IOException { + void duplicateFactoryMethodShouldGenerateNewObjectWithSameValuesButName() throws MessagingException, IOException { String name = MailUtil.newId(); MailImpl mail = MailImpl.builder() .name(name) @@ -154,7 +154,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void setAttributeShouldThrowOnNullAttributeName() throws MessagingException { + void setAttributeShouldThrowOnNullAttributeName() { MailImpl mail = newMail(); assertThatThrownBy(() -> mail.setAttribute(null, "toto")) @@ -162,23 +162,23 @@ public class MailImplTest extends ContractMailTest { } @Test - public void deriveNewNameShouldThrowOnNull() { + void deriveNewNameShouldThrowOnNull() { assertThatThrownBy(() -> MailImpl.deriveNewName(null)).isInstanceOf(NullPointerException.class); } @Test - public void deriveNewNameShouldGenerateNonEmptyStringOnEmpty() throws MessagingException { + void deriveNewNameShouldGenerateNonEmptyStringOnEmpty() throws MessagingException { assertThat(MailImpl.deriveNewName("")).isNotEmpty(); } @Test - public void deriveNewNameShouldNeverGenerateMoreThan86Characters() throws MessagingException { + void deriveNewNameShouldNeverGenerateMoreThan86Characters() throws MessagingException { String longString = "mu1Eeseemu1Eeseemu1Eeseemu1Eeseemu1Eeseemu1Eeseemu1Eeseemu1Eeseemu1Eeseeseemu1Eesee"; assertThat(MailImpl.deriveNewName(longString).length()).isLessThan(86); } @Test - public void deriveNewNameShouldThrowWhenMoreThan8NestedCalls() throws MessagingException { + void deriveNewNameShouldThrowWhenMoreThan8NestedCalls() { String called6Times = IntStream.range(0, 8) .mapToObj(String::valueOf) .reduce("average value ", Throwing.binaryOperator((left, right) -> MailImpl.deriveNewName(left))); @@ -186,7 +186,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void deriveNewNameShouldThrowWhenMoreThan8NestedCallsAndSmallInitialValue() throws MessagingException { + void deriveNewNameShouldThrowWhenMoreThan8NestedCallsAndSmallInitialValue() { String called6Times = IntStream.range(0, 8) .mapToObj(String::valueOf) .reduce("small", Throwing.binaryOperator((left, right) -> MailImpl.deriveNewName(left))); @@ -194,7 +194,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void deriveNewNameShouldThrowWhenMoreThan8NestedCallsAndLongInitialValue() throws MessagingException { + void deriveNewNameShouldThrowWhenMoreThan8NestedCallsAndLongInitialValue() { String called6Times = IntStream.range(0, 8) .mapToObj(String::valueOf) .reduce("looooooonnnnnngggggggggggggggg", Throwing.binaryOperator((left, right) -> MailImpl.deriveNewName(left))); @@ -202,12 +202,12 @@ public class MailImplTest extends ContractMailTest { } @Test - public void deriveNewNameShouldGenerateNotEqualsCurrentName() throws MessagingException { + void deriveNewNameShouldGenerateNotEqualsCurrentName() throws MessagingException { assertThat(MailImpl.deriveNewName("current")).isNotEqualTo("current"); } @Test - public void getMaybeSenderShouldHandleNullSender() { + void getMaybeSenderShouldHandleNullSender() { assertThat( MailImpl.builder() .name("mail-id") @@ -218,7 +218,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void getMaybeSenderShouldHandleNoSender() { + void getMaybeSenderShouldHandleNoSender() { assertThat( MailImpl.builder() .name("mail-id") @@ -228,7 +228,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void getMaybeSenderShouldHandleSender() { + void getMaybeSenderShouldHandleSender() { assertThat( MailImpl.builder() .name("mail-id") @@ -239,7 +239,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void hasSenderShouldReturnFalseWhenSenderIsNull() { + void hasSenderShouldReturnFalseWhenSenderIsNull() { assertThat( MailImpl.builder() .name("mail-id") @@ -250,7 +250,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void hasSenderShouldReturnFalseWhenSenderIsNotSpecified() { + void hasSenderShouldReturnFalseWhenSenderIsNotSpecified() { assertThat( MailImpl.builder() .name("mail-id") @@ -260,7 +260,7 @@ public class MailImplTest extends ContractMailTest { } @Test - public void hasSenderShouldReturnTrueWhenSenderIsSpecified() { + void hasSenderShouldReturnTrueWhenSenderIsSpecified() { assertThat( MailImpl.builder() .name("mail-id") @@ -271,25 +271,25 @@ public class MailImplTest extends ContractMailTest { } @Test - public void builderShouldNotAllowNullName() { + void builderShouldNotAllowNullName() { assertThatThrownBy(() -> MailImpl.builder().name(null)) .isInstanceOf(NullPointerException.class); } @Test - public void builderShouldNotAllowEmptyName() { + void builderShouldNotAllowEmptyName() { assertThatThrownBy(() -> MailImpl.builder().name("")) .isInstanceOf(IllegalArgumentException.class); } @Test - public void mailImplShouldNotAllowSettingNullName() { + void mailImplShouldNotAllowSettingNullName() { assertThatThrownBy(() -> newMail().setName(null)) .isInstanceOf(NullPointerException.class); } @Test - public void mailImplShouldNotAllowSettingEmptyName() { + void mailImplShouldNotAllowSettingEmptyName() { assertThatThrownBy(() -> newMail().setName("")) .isInstanceOf(IllegalArgumentException.class); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
