commit b1478b8fb5bb2a96ba4367bc156b770d29baa7b8 Author: Karsten Loesing karsten.loesing@gmx.net Date: Tue Jun 17 13:44:55 2014 +0200
Add unit tests for 2351cea. --- .../descriptor/impl/ExtraInfoDescriptorImplTest.java | 11 +++++++++++ .../descriptor/impl/ServerDescriptorImplTest.java | 9 +++++++++ 2 files changed, 20 insertions(+)
diff --git a/test/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java b/test/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java index cd23ab0..f73b4a1 100644 --- a/test/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java +++ b/test/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java @@ -745,6 +745,17 @@ public class ExtraInfoDescriptorImplTest { descriptor.getFingerprint()); }
+ @Test() + public void testExtraInfoNicknameTwoSpaces() + throws DescriptorParseException { + ExtraInfoDescriptor descriptor = DescriptorBuilder. + createWithExtraInfoLine("opt extra-info chaoscomputerclub5 " + + "A9C039A5FD02FCA06303DCFAABE25C5912C63B26"); + assertEquals("chaoscomputerclub5", descriptor.getNickname()); + assertEquals("A9C039A5FD02FCA06303DCFAABE25C5912C63B26", + descriptor.getFingerprint()); + } + @Test(expected = DescriptorParseException.class) public void testExtraInfoLineNotFirst() throws DescriptorParseException { diff --git a/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java b/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java index b2160a5..85aa761 100644 --- a/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java +++ b/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java @@ -402,6 +402,15 @@ public class ServerDescriptorImplTest { + "saberrider2008ReallyLongNickname 94.134.192.243 9001 0 0"); }
+ @Test() + public void testNicknameTwoSpaces() throws DescriptorParseException { + ServerDescriptor descriptor = DescriptorBuilder. + createWithRouterLine("router saberrider2008 " + + "94.134.192.243 9001 0 0"); + assertEquals("saberrider2008", descriptor.getNickname()); + assertEquals("94.134.192.243", descriptor.getAddress()); + } + @Test(expected = DescriptorParseException.class) public void testAddress24() throws DescriptorParseException { DescriptorBuilder.createWithRouterLine("router saberrider2008 "
tor-commits@lists.torproject.org