@Test
|
public void testMultipleAts() {
|
MongoURI uri = new MongoURI("mongodb://usernme:p@ssword@localhost:27017/test");
|
assertEquals("p@ssword", uri.getPassword()); // <-- FAILS
|
|
// this behavior might be expected behavior as '@' should be URI-escaped
|
// however maybe a parse error should be thrown since at this point:
|
// * uri.getHosts() == ["ssword@localhost:27017"]
|
// * uri.getPassword() == ['p']
|
}
|
|
@Test
|
public void testUriEscaping() {
|
MongoURI uri = new MongoURI("mongodb://usernme:p%40ssword@localhost:27017/test");
|
assertEquals("p@ssword", uri.getPassword()); // <-- FAILS and shouldn't
|
|
// at this point uri.getPassword() == ['p', '%', '4', '0', 's', 's', 'w', 'o', 'r', 'd']
|
// which is wrong
|
}
|