Github user enixon commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/549#discussion_r198339563 --- Diff: src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerConfigTest.java --- @@ -103,6 +103,23 @@ public void testCustomSSLAuth() } } + /** + * Test case for https://issues.apache.org/jira/browse/ZOOKEEPER-2873 + */ + @Test + public void testSamePortConfiguredForClientAndElection() throws IOException, ConfigException { + QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig(); + try { + Properties zkProp = getDefaultZKProperties(); + zkProp.setProperty("server.1", "localhost:2888:2888"); + quorumPeerConfig.parseProperties(zkProp); + fail("ConfigException is expected"); + } catch (ConfigException ce) { --- End diff -- Instead of the try-catch paradigm, can we use `@Test(expected = ConfigException.class)`?
---