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/04/20 00:48:37 UTC
[2/3] james-project git commit: JAMES-1904 Increase test coverage on
XMLDomainList
JAMES-1904 Increase test coverage on XMLDomainList
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/3e5a16d4
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/3e5a16d4
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/3e5a16d4
Branch: refs/heads/master
Commit: 3e5a16d405c0ee4dbd353fb7c91698f33cf9528a
Parents: 06b6e48
Author: Antoine Duprat <ad...@linagora.com>
Authored: Wed Apr 19 13:47:49 2017 +0200
Committer: benwa <bt...@linagora.com>
Committed: Thu Apr 20 07:47:38 2017 +0700
----------------------------------------------------------------------
.../james/domainlist/xml/XMLDomainListTest.java | 34 ++++++++++++++++++++
1 file changed, 34 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/3e5a16d4/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java b/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
index 5d14c11..15a07ff 100644
--- a/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
+++ b/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
@@ -29,11 +29,17 @@ import org.apache.commons.configuration.DefaultConfigurationBuilder;
import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.james.dnsservice.api.DNSService;
import org.apache.james.dnsservice.api.mock.MockDNSService;
+import org.apache.james.domainlist.api.DomainListException;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.slf4j.LoggerFactory;
public class XMLDomainListTest {
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
private HierarchicalConfiguration setUpConfiguration(boolean auto, boolean autoIP, List<String> names) {
DefaultConfigurationBuilder configuration = new DefaultConfigurationBuilder();
@@ -117,4 +123,32 @@ public class XMLDomainListTest {
assertThat(dom.getDomains()).describedAs("One domain found").hasSize(1);
}
+
+ @Test
+ public void addDomainShouldFailWhenAlreadyConfigured() throws Exception {
+ expectedException.expect(DomainListException.class);
+
+ List<String> domains = new ArrayList<String>();
+ domains.add("domain1");
+
+ XMLDomainList testee = new XMLDomainList();
+ testee.setLog(LoggerFactory.getLogger("MockLog"));
+ testee.configure(setUpConfiguration(true, false, domains));
+
+ testee.addDomain("newDomain");
+ }
+
+ @Test
+ public void removeDomainShouldFailWhenAlreadyConfigured() throws Exception {
+ expectedException.expect(DomainListException.class);
+
+ List<String> domains = new ArrayList<String>();
+ domains.add("domain1");
+
+ XMLDomainList testee = new XMLDomainList();
+ testee.setLog(LoggerFactory.getLogger("MockLog"));
+ testee.configure(setUpConfiguration(true, false, domains));
+
+ testee.removeDomain("newDomain");
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org