commit 8678345af9922ca4431b084d75419961dac562fa Author: Karsten Loesing karsten.loesing@gmx.net Date: Mon Jul 3 15:35:39 2017 +0200
Avoid non-ASCII characters in expected messages.
This currently breaks Jenkins build, which is not exactly our fault but Jenkin's. But this is test code, so it's easier to just adapt. --- .../torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java | 5 +++-- .../org/torproject/descriptor/impl/ServerDescriptorImplTest.java | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/test/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java b/src/test/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java index 9633f2b..5a3f0f2 100644 --- a/src/test/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java +++ b/src/test/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java @@ -1879,8 +1879,9 @@ public class ExtraInfoDescriptorImplTest { public void testBridgeIpsNonAsciiKeyword() throws DescriptorParseException { this.thrown.expect(DescriptorParseException.class); - this.thrown.expectMessage("Unrecognized character in keyword " - + "'�bridge-ips' in line '�bridge-ips'."); + this.thrown.expectMessage(Matchers.allOf( + Matchers.containsString("Unrecognized character in keyword "), + Matchers.containsString("bridge-ips'"))); DescriptorBuilder.createWithNonAsciiLineBytes(new byte[] { 0x14, (byte) 0xfe, 0x18, // non-ascii chars 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2d, // "bridge-" diff --git a/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java b/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java index 534cb0e..e814b4c 100644 --- a/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java +++ b/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java @@ -14,6 +14,7 @@ import org.torproject.descriptor.BridgeServerDescriptor; import org.torproject.descriptor.DescriptorParseException; import org.torproject.descriptor.ServerDescriptor;
+import org.hamcrest.Matchers; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -1549,9 +1550,9 @@ public class ServerDescriptorImplTest { public void testAllowSingleHopExitsNonAsciiKeyword() throws DescriptorParseException { this.thrown.expect(DescriptorParseException.class); - this.thrown.expectMessage("Unrecognized character in keyword " - + "'�allow-single-hop-exits' in line " - + "'�allow-single-hop-exits'."); + this.thrown.expectMessage(Matchers.allOf( + Matchers.containsString("Unrecognized character in keyword "), + Matchers.containsString("allow-single-hop-exits'"))); DescriptorBuilder.createWithNonAsciiLineBytes(new byte[] { 0x14, (byte) 0xfe, 0x18, // non-ascii chars 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x2d, // "allow-"