Skip to content

Commit

Permalink
Merge pull request #1 from mindfocus/mindfocus-patch-1
Browse files Browse the repository at this point in the history
Update ConfigurationTest.java
  • Loading branch information
mindfocus authored Jun 25, 2024
2 parents 2f67463 + 6e982d9 commit 4ca53f5
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,27 @@ public void testToStringParseEmpty() {
assertEquals(conf, newConf);
}

@Test
public void testToStringParseWithSpace() {
final String confStr = "localhost:8081, localhost:8082, localhost:8083";
final Configuration conf = JRaftUtils.getConfiguration(confStr);
assertEquals(3, conf.size());
for (final PeerId peer : conf) {
assertTrue(peer.toString().startsWith("localhost:80"));
}
assertFalse(conf.isEmpty());
assertEquals(confStr, conf.toString());
final Configuration newConf = new Configuration();
assertTrue(newConf.parse(conf.toString()));
assertEquals(3, newConf.getPeerSet().size());
assertTrue(newConf.contains(new PeerId("localhost", 8081)));
assertTrue(newConf.contains(new PeerId("localhost", 8082)));
assertTrue(newConf.contains(new PeerId("localhost", 8083)));
assertEquals(confStr, newConf.toString());
assertEquals(conf.hashCode(), newConf.hashCode());
assertEquals(conf, newConf);
}

@Test
public void testToStringParseStuff() {
final String confStr = "localhost:8081,localhost:8082,localhost:8083";
Expand Down

0 comments on commit 4ca53f5

Please sign in to comment.