Author: matthieu Date: Mon Nov 2 13:46:44 2015 New Revision: 1711985 URL: http://svn.apache.org/viewvc?rev=1711985&view=rev Log: JAMES-1595 Update tests to assert on Mapping objects instead of strings
Modified: james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTableTest.java james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/MappingsImplTest.java Modified: james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTableTest.java URL: http://svn.apache.org/viewvc/james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTableTest.java?rev=1711985&r1=1711984&r2=1711985&view=diff ============================================================================== --- james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTableTest.java (original) +++ james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTableTest.java Mon Nov 2 13:46:44 2015 @@ -247,8 +247,8 @@ public abstract class AbstractRecipientR assertTrue("Add mapping", addMapping(user1, domain1, user2 + "@" + domain2, ADDRESS_TYPE)); assertTrue("Add mapping", addMapping(user2, domain2, user3 + "@" + domain3, ADDRESS_TYPE)); - assertEquals("Recursive mapped", virtualUserTable.getMappings(user1, domain1).asStrings().iterator().next(), - user3 + "@" + domain3); + assertEquals("Recursive mapped", virtualUserTable.getMappings(user1, domain1).iterator().next(), + MappingImpl.of(user3 + "@" + domain3)); assertTrue("Add mapping", addMapping(user3, domain3, user1 + "@" + domain1, ADDRESS_TYPE)); try { @@ -260,8 +260,8 @@ public abstract class AbstractRecipientR // disable recursive mapping virtualUserTable.setRecursiveMapping(false); - assertEquals("Not recursive mapped", virtualUserTable.getMappings(user1, domain1).asStrings().iterator().next(), - user2 + "@" + domain2); + assertEquals("Not recursive mapped", virtualUserTable.getMappings(user1, domain1).iterator().next(), + MappingImpl.of(user2 + "@" + domain2)); } catch (IllegalArgumentException e) { fail("Storing failed"); Modified: james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/MappingsImplTest.java URL: http://svn.apache.org/viewvc/james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/MappingsImplTest.java?rev=1711985&r1=1711984&r2=1711985&view=diff ============================================================================== --- james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/MappingsImplTest.java (original) +++ james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/MappingsImplTest.java Mon Nov 2 13:46:44 2015 @@ -41,82 +41,82 @@ public class MappingsImplTest { @Test public void fromRawStringShouldReturnSingletonCollectionWhenSingleElementString() { MappingsImpl actual = MappingsImpl.fromRawString("value"); - assertThat(actual.asStrings()).containsExactly("value"); + assertThat(actual).containsExactly(MappingImpl.of("value")); } @Test public void fromRawStringShouldReturnCollectionWhenSeveralElementsString() { MappingsImpl actual = MappingsImpl.fromRawString("value1;value2"); - assertThat(actual.asStrings()).containsExactly("value1", "value2"); + assertThat(actual).containsExactly(MappingImpl.of("value1"), MappingImpl.of("value2")); } @Test public void fromRawStringShouldReturnSingleElementCollectionWhenTrailingDelimiterString() { MappingsImpl actual = MappingsImpl.fromRawString("value1;"); - assertThat(actual.asStrings()).containsExactly("value1"); + assertThat(actual).containsExactly(MappingImpl.of("value1")); } @Test public void fromRawStringShouldReturnSingleElementCollectionWhenHeadingDelimiterString() { MappingsImpl actual = MappingsImpl.fromRawString(";value1"); - assertThat(actual.asStrings()).containsExactly("value1"); + assertThat(actual).containsExactly(MappingImpl.of("value1")); } @Test public void fromRawStringShouldTrimValues() { MappingsImpl actual = MappingsImpl.fromRawString("value1 ; value2 "); - assertThat(actual.asStrings()).containsExactly("value1", "value2"); + assertThat(actual).containsExactly(MappingImpl.of("value1"), MappingImpl.of("value2")); } @Test public void fromRawStringShouldNotSkipEmptyValue() { MappingsImpl actual = MappingsImpl.fromRawString("value1; ;value2"); - assertThat(actual.asStrings()).containsExactly("value1", "", "value2"); + assertThat(actual).containsExactly(MappingImpl.of("value1"), MappingImpl.of(""), MappingImpl.of("value2")); } @Test public void fromRawStringShouldReturnCollectionWhenValueContainsCommaSeperatedValues() { MappingsImpl actual = MappingsImpl.fromRawString("value1,value2"); - assertThat(actual.asStrings()).containsExactly("value1","value2"); + assertThat(actual).containsExactly(MappingImpl.of("value1"),MappingImpl.of("value2")); } @Test public void fromRawStringShouldReturnCollectionWhenValueContainsColonSeperatedValues() { MappingsImpl actual = MappingsImpl.fromRawString("value1:value2"); - assertThat(actual.asStrings()).containsExactly("value1","value2"); + assertThat(actual).containsExactly(MappingImpl.of("value1"),MappingImpl.of("value2")); } @Test public void fromRawStringShouldUseCommaDelimiterBeforeSemicolonWhenValueContainsBoth() { MappingsImpl actual = MappingsImpl.fromRawString("value1;value1,value2"); - assertThat(actual.asStrings()).containsExactly("value1;value1","value2"); + assertThat(actual).containsExactly(MappingImpl.of("value1;value1"),MappingImpl.of("value2")); } @Test public void fromRawStringShouldUseSemicolonDelimiterBeforeColonWhenValueContainsBoth() { MappingsImpl actual = MappingsImpl.fromRawString("value1:value1;value2"); - assertThat(actual.asStrings()).containsExactly("value1:value1","value2"); + assertThat(actual).containsExactly(MappingImpl.of("value1:value1"),MappingImpl.of("value2")); } @Test public void fromRawStringShouldNotUseColonDelimiterWhenValueStartsWithError() { MappingsImpl actual = MappingsImpl.fromRawString("error:test"); - assertThat(actual.asStrings()).containsExactly("error:test"); + assertThat(actual).containsExactly(MappingImpl.of("error:test")); } @Test public void fromRawStringShouldNotUseColonDelimiterWhenValueStartsWithDomain() { MappingsImpl actual = MappingsImpl.fromRawString("domain:test"); - assertThat(actual.asStrings()).containsExactly("domain:test"); + assertThat(actual).containsExactly(MappingImpl.of("domain:test")); } @Test public void fromRawStringShouldNotUseColonDelimiterWhenValueStartsWithRegex() { MappingsImpl actual = MappingsImpl.fromRawString("regex:test"); - assertThat(actual.asStrings()).containsExactly("regex:test"); + assertThat(actual).containsExactly(MappingImpl.of("regex:test")); } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org