summaryrefslogtreecommitdiffstats
path: root/jrt
diff options
context:
space:
mode:
Diffstat (limited to 'jrt')
-rw-r--r--jrt/tests/com/yahoo/jrt/TlsDetectionTest.java17
1 files changed, 6 insertions, 11 deletions
diff --git a/jrt/tests/com/yahoo/jrt/TlsDetectionTest.java b/jrt/tests/com/yahoo/jrt/TlsDetectionTest.java
index 9bd37e25772..47a8a20deab 100644
--- a/jrt/tests/com/yahoo/jrt/TlsDetectionTest.java
+++ b/jrt/tests/com/yahoo/jrt/TlsDetectionTest.java
@@ -1,20 +1,18 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jrt;
+import static org.junit.Assert.assertEquals;
+
public class TlsDetectionTest {
- static private String message(byte[] data, boolean actual) {
- String msg = "[";
+ static private String message(byte[] data) {
+ String msg = "isTls([";
String delimiter = "";
for (byte b: data) {
msg += delimiter + (b & 0xff);
delimiter = ", ";
}
- if (actual) {
- msg += "] wrongfully detected as tls";
- } else {
- msg += "] wrongfully rejected as not tls";
- }
+ msg += "])";
return msg;
}
@@ -23,10 +21,7 @@ public class TlsDetectionTest {
for (int i = 0; i < data.length; i++) {
data[i] = (byte) values[i];
}
- boolean actual = MaybeTlsCryptoSocket.looksLikeTlsToMe(data);
- if(actual != expect) {
- throw new AssertionError(message(data, actual));
- }
+ assertEquals(message(data), expect, MaybeTlsCryptoSocket.looksLikeTlsToMe(data));
}
@org.junit.Test public void testValidHandshake() {