chibenwa commented on code in PR #2405:
URL: https://github.com/apache/james-project/pull/2405#discussion_r1763025596
##########
core/src/test/java/org/apache/james/core/MailAddressTest.java:
##########
@@ -225,4 +228,93 @@ void shouldMatchBeanContract() {
EqualsVerifier.forClass(MailAddress.class)
.verify();
}
+
+ @Test
+ void getLocalPartDetailsShouldReturnDetails() throws AddressException {
+ MailAddress mailAddress = new
MailAddress("[email protected]");
+ assertThat(mailAddress.getLocalPartDetails("+")).contains("details");
+ }
+
+ @Test
+ void getLocalPartDetailsShouldReturnEmptyWhenNone() throws
AddressException {
+ MailAddress mailAddress = new MailAddress("[email protected]");
+ assertThat(mailAddress.getLocalPartDetails("+")).isEmpty();
+ }
+
+ @Test
+ void getLocalPartDetailsShouldReturnEmptyWhenEmpty() throws
AddressException {
+ MailAddress mailAddress = new MailAddress("[email protected]");
+ assertThat(mailAddress.getLocalPartDetails("+")).contains("");
+ }
+
+ @Test
+ void
getLocalPartDetailsShouldReturnDetailsIncludingOtherOccurencesOfDelimiter()
throws AddressException {
+ MailAddress mailAddress = new
MailAddress("[email protected]");
+ assertThat(mailAddress.getLocalPartDetails("+")).contains("de+tails");
+ }
+
+ @Test
+ void getLocalPartDetailsShouldReturnEmptyWhenAddressStartsWithDelimiter()
throws AddressException {
+ MailAddress mailAddress = new MailAddress("[email protected]");
+ assertThat(mailAddress.getLocalPartDetails("+")).isEmpty();
+ }
+
+ @Test
+ void
getLocalPartDetailsShouldReturnDetailsWhenMultipleCharacterDelimiter() throws
AddressException {
+ MailAddress mailAddress = new
MailAddress("[email protected]");
+ assertThat(mailAddress.getLocalPartDetails("--")).contains("details");
+ }
+
+ @Test
+ void getLocalPartDetailsShouldBePreciseWithMultipleCharacterDelimiter()
throws AddressException {
+ MailAddress mailAddress = new
MailAddress("[email protected]");
+ assertThat(mailAddress.getLocalPartDetails("--")).contains("-details");
+ }
+
+
+
+
+
+ @Test
Review Comment:
```suggestion
}
@Test
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]