JAMES-2366 migration of MappingTest to junit 5
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/776fc33a Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/776fc33a Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/776fc33a Branch: refs/heads/master Commit: 776fc33acb59de3772b63fc6a8c278f7dd57d088 Parents: f0ce9cc Author: Matthieu Baechler <matth...@apache.org> Authored: Fri Apr 20 15:33:33 2018 +0200 Committer: Matthieu Baechler <matth...@apache.org> Committed: Tue Apr 24 14:49:33 2018 +0200 ---------------------------------------------------------------------- .../org/apache/james/rrt/lib/MappingTest.java | 98 ++++++++++---------- 1 file changed, 49 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/776fc33a/server/data/data-api/src/test/java/org/apache/james/rrt/lib/MappingTest.java ---------------------------------------------------------------------- diff --git a/server/data/data-api/src/test/java/org/apache/james/rrt/lib/MappingTest.java b/server/data/data-api/src/test/java/org/apache/james/rrt/lib/MappingTest.java index d14dd6b..63fd182 100644 --- a/server/data/data-api/src/test/java/org/apache/james/rrt/lib/MappingTest.java +++ b/server/data/data-api/src/test/java/org/apache/james/rrt/lib/MappingTest.java @@ -31,276 +31,276 @@ import nl.jqno.equalsverifier.EqualsVerifier; public class MappingTest { @Test - public void hasPrefixShouldReturnTrueWhenRegex() { + void hasPrefixShouldReturnTrueWhenRegex() { boolean hasPrefix = Mapping.Type.hasPrefix(Type.Regex.asPrefix() + "myRegex"); assertThat(hasPrefix).isTrue(); } @Test - public void hasPrefixShouldReturnTrueWhenDomain() { + void hasPrefixShouldReturnTrueWhenDomain() { boolean hasPrefix = Mapping.Type.hasPrefix(Type.Domain.asPrefix() + "myRegex"); assertThat(hasPrefix).isTrue(); } @Test - public void hasPrefixShouldReturnTrueWhenError() { + void hasPrefixShouldReturnTrueWhenError() { boolean hasPrefix = Mapping.Type.hasPrefix(Type.Error.asPrefix() + "myRegex"); assertThat(hasPrefix).isTrue(); } @Test - public void hasPrefixShouldReturnTrueWhenForward() { + void hasPrefixShouldReturnTrueWhenForward() { boolean hasPrefix = Mapping.Type.hasPrefix(Type.Forward.asPrefix() + "myRegex"); assertThat(hasPrefix).isTrue(); } @Test - public void hasPrefixShouldReturnFalseWhenAddress() { + void hasPrefixShouldReturnFalseWhenAddress() { boolean hasPrefix = Mapping.Type.hasPrefix(Type.Address.asPrefix() + "myRegex"); assertThat(hasPrefix).isFalse(); } @Test - public void detectTypeShouldReturnAddressWhenAddressPrefix() { + void detectTypeShouldReturnAddressWhenAddressPrefix() { assertThat(Mapping.detectType(Type.Address.asPrefix() + "mapping")) .isEqualTo(Type.Address); } @Test - public void detectTypeShouldReturnRegexWhenRegexPrefix() { + void detectTypeShouldReturnRegexWhenRegexPrefix() { assertThat(Mapping.detectType(Type.Regex.asPrefix() + "mapping")) .isEqualTo(Type.Regex); } @Test - public void detectTypeShouldReturnErrorWhenErrorPrefix() { + void detectTypeShouldReturnErrorWhenErrorPrefix() { assertThat(Mapping.detectType(Type.Error.asPrefix() + "mapping")) .isEqualTo(Type.Error); } @Test - public void detectTypeShouldReturnDomainWhenDomainPrefix() { + void detectTypeShouldReturnDomainWhenDomainPrefix() { assertThat(Mapping.detectType(Type.Domain.asPrefix() + "mapping")) .isEqualTo(Type.Domain); } @Test - public void detectTypeShouldReturnForwardWhenForwardPrefix() { + void detectTypeShouldReturnForwardWhenForwardPrefix() { assertThat(Mapping.detectType(Type.Forward.asPrefix() + "mapping")) .isEqualTo(Type.Forward); } @Test - public void withoutPrefixShouldRemoveAddressPrefix() { + void withoutPrefixShouldRemoveAddressPrefix() { assertThat(Type.Address.withoutPrefix(Type.Address.asPrefix() + "mapping")) .isEqualTo("mapping"); } @Test - public void withoutPrefixShouldDoNothingWhenAddressAndNoPrefix() { + void withoutPrefixShouldDoNothingWhenAddressAndNoPrefix() { assertThat(Type.Address.withoutPrefix("mapping")) .isEqualTo("mapping"); } @Test - public void withoutPrefixShouldRemoveDomainPrefix() { + void withoutPrefixShouldRemoveDomainPrefix() { assertThat(Type.Domain.withoutPrefix(Type.Domain.asPrefix() + "mapping")) .isEqualTo("mapping"); } @Test - public void withoutPrefixShouldRemoveErrorPrefix() { + void withoutPrefixShouldRemoveErrorPrefix() { assertThat(Type.Error.withoutPrefix(Type.Error.asPrefix() + "mapping")) .isEqualTo("mapping"); } @Test - public void withoutPrefixShouldRemoveRegexPrefix() { + void withoutPrefixShouldRemoveRegexPrefix() { assertThat(Type.Regex.withoutPrefix(Type.Regex.asPrefix() + "mapping")) .isEqualTo("mapping"); } @Test - public void withoutPrefixShouldRemoveForwardPrefix() { + void withoutPrefixShouldRemoveForwardPrefix() { assertThat(Type.Forward.withoutPrefix(Type.Forward.asPrefix() + "mapping")) .isEqualTo("mapping"); } @Test - public void withoutPrefixShouldThrowOnBadPrefix() { + void withoutPrefixShouldThrowOnBadPrefix() { assertThatThrownBy(() -> Type.Regex.withoutPrefix(Type.Domain.asPrefix() + "mapping")) .isInstanceOf(IllegalArgumentException.class); } @Test - public void withoutPrefixShouldThrowWhenNoPrefix() { + void withoutPrefixShouldThrowWhenNoPrefix() { assertThatThrownBy(() -> Type.Regex.withoutPrefix("mapping")) .isInstanceOf(IllegalArgumentException.class); } @Test - public void withoutPrefixShouldThrowWhenNoPrefixOnForwardType() { + void withoutPrefixShouldThrowWhenNoPrefixOnForwardType() { assertThatThrownBy(() -> Type.Forward.withoutPrefix("mapping")) .isInstanceOf(IllegalArgumentException.class); } @Test - public void beanShouldRespectBeanContract() { + void beanShouldRespectBeanContract() { EqualsVerifier.forClass(Mapping.Impl.class) .verify(); } @Test - public void addressFactoryMethodShouldThrowOnNull() { + void addressFactoryMethodShouldThrowOnNull() { assertThatThrownBy(() -> Mapping.address(null)) .isInstanceOf(NullPointerException.class); } @Test - public void regexFactoryMethodShouldThrowOnNull() { + void regexFactoryMethodShouldThrowOnNull() { assertThatThrownBy(() -> Mapping.regex(null)) .isInstanceOf(NullPointerException.class); } @Test - public void domainFactoryMethodShouldThrowOnNull() { + void domainFactoryMethodShouldThrowOnNull() { assertThatThrownBy(() -> Mapping.domain(null)) .isInstanceOf(NullPointerException.class); } @Test - public void errorFactoryMethodShouldThrowOnNull() { + void errorFactoryMethodShouldThrowOnNull() { assertThatThrownBy(() -> Mapping.error(null)) .isInstanceOf(NullPointerException.class); } @Test - public void forwardFactoryMethodShouldThrowOnNull() { + void forwardFactoryMethodShouldThrowOnNull() { assertThatThrownBy(() -> Mapping.forward(null)) .isInstanceOf(NullPointerException.class); } @Test - public void groupFactoryMethodShouldThrowOnNull() { + void groupFactoryMethodShouldThrowOnNull() { assertThatThrownBy(() -> Mapping.group(null)) .isInstanceOf(NullPointerException.class); } @Test - public void hasDomainShouldReturnTrueWhenMappingContainAtMark() { + void hasDomainShouldReturnTrueWhenMappingContainAtMark() { assertThat(Mapping.address("a@b").hasDomain()).isTrue(); } @Test - public void hasDomainShouldReturnFalseWhenMappingIsEmpty() { + void hasDomainShouldReturnFalseWhenMappingIsEmpty() { assertThat(Mapping.address("").hasDomain()).isFalse(); } @Test - public void hasDomainShouldReturnFalseWhenMappingIsBlank() { + void hasDomainShouldReturnFalseWhenMappingIsBlank() { assertThat(Mapping.address(" ").hasDomain()).isFalse(); } @Test - public void hasDomainShouldReturnFalseWhenMappingDoesntContainAtMark() { + void hasDomainShouldReturnFalseWhenMappingDoesntContainAtMark() { assertThat(Mapping.address("abc").hasDomain()).isFalse(); } @Test - public void appendDefaultDomainShouldWorkOnValidDomain() { + void appendDefaultDomainShouldWorkOnValidDomain() { assertThat(Mapping.address("abc").appendDomainIfNone(() -> Domain.of("domain"))).isEqualTo(Mapping.address("abc@domain")); } @Test - public void appendDefaultDomainShouldNotAddDomainWhenMappingAlreadyContainsDomains() { + void appendDefaultDomainShouldNotAddDomainWhenMappingAlreadyContainsDomains() { assertThat(Mapping.address("abc@d").appendDomainIfNone(() -> Domain.of("domain"))).isEqualTo(Mapping.address("abc@d")); } @Test - public void appendDomainShouldThrowWhenNullDomain() { + void appendDomainShouldThrowWhenNullDomain() { assertThatThrownBy(() -> Mapping.address("abc@d").appendDomainIfNone(null)).isInstanceOf(NullPointerException.class); } @Test - public void getTypeShouldReturnAddressWhenNoPrefix() { + void getTypeShouldReturnAddressWhenNoPrefix() { assertThat(Mapping.address("abc").getType()).isEqualTo(Mapping.Type.Address); } @Test - public void getTypeShouldReturnAddressWhenEmpty() { + void getTypeShouldReturnAddressWhenEmpty() { assertThat(Mapping.address("").getType()).isEqualTo(Mapping.Type.Address); } @Test - public void getTypeShouldReturnRegexWhenRegexPrefix() { + void getTypeShouldReturnRegexWhenRegexPrefix() { assertThat(Mapping.regex("abc").getType()).isEqualTo(Mapping.Type.Regex); } @Test - public void getTypeShouldReturnErrorWhenErrorPrefix() { + void getTypeShouldReturnErrorWhenErrorPrefix() { assertThat(Mapping.error("abc").getType()).isEqualTo(Mapping.Type.Error); } @Test - public void getTypeShouldReturnDomainWhenDomainPrefix() { + void getTypeShouldReturnDomainWhenDomainPrefix() { assertThat(Mapping.domain(Domain.of("abc")).getType()).isEqualTo(Mapping.Type.Domain); } @Test - public void getTypeShouldReturnForwardWhenForwardPrefix() { + void getTypeShouldReturnForwardWhenForwardPrefix() { assertThat(Mapping.forward("abc").getType()).isEqualTo(Mapping.Type.Forward); } @Test - public void getTypeShouldReturnGroupWhenGroupPrefix() { + void getTypeShouldReturnGroupWhenGroupPrefix() { assertThat(Mapping.group("abc").getType()).isEqualTo(Mapping.Type.Group); } @Test - public void getErrorMessageShouldThrowWhenMappingIsNotAnError() { + void getErrorMessageShouldThrowWhenMappingIsNotAnError() { assertThatThrownBy(() -> Mapping.domain(Domain.of("toto")).getErrorMessage()) .isInstanceOf(IllegalStateException.class); } @Test - public void getErrorMessageShouldReturnMessageWhenErrorWithMessage() { + void getErrorMessageShouldReturnMessageWhenErrorWithMessage() { assertThat(Mapping.error("toto").getErrorMessage()).isEqualTo("toto"); } @Test - public void getErrorMessageShouldReturnWhenErrorWithoutMessage() { + void getErrorMessageShouldReturnWhenErrorWithoutMessage() { assertThat(Mapping.error("").getErrorMessage()).isEqualTo(""); } @Test - public void asMailAddressShouldReturnMappingValueForAddress() throws Exception { + void asMailAddressShouldReturnMappingValueForAddress() throws Exception { assertThat(Mapping.address("value@domain").asMailAddress()) .contains(new MailAddress("value@domain")); } @Test - public void asMailAddressShouldReturnEmptyOnInvalidAddress() { + void asMailAddressShouldReturnEmptyOnInvalidAddress() { assertThat(Mapping.address("value").asMailAddress()) .isEmpty(); } @Test - public void asMailAddressShouldReturnEmptyForError() { + void asMailAddressShouldReturnEmptyForError() { assertThat(Mapping.error("value").asMailAddress()).isEmpty(); } @Test - public void asMailAddressShouldReturnEmptyForRegex() { + void asMailAddressShouldReturnEmptyForRegex() { assertThat(Mapping.regex("value").asMailAddress()).isEmpty(); } @Test - public void asMailAddressShouldReturnEmptyForDomain() { + void asMailAddressShouldReturnEmptyForDomain() { assertThat(Mapping.domain(Domain.of("value")).asMailAddress()).isEmpty(); } @Test - public void asMailAddressShouldReturnMappingValueForForward() throws Exception { + void asMailAddressShouldReturnMappingValueForForward() throws Exception { assertThat(Mapping.forward("value@domain").asMailAddress()) .contains(new MailAddress("value@domain")); } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org