diff options
author | Ade Lee <alee@redhat.com> | 2012-01-11 12:57:53 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2012-01-11 13:49:04 -0500 |
commit | 10cfe7756e967ac91c66d33b392aeab9cf3780fb (patch) | |
tree | d5ac9b58442265d2ce5ef60e31f041ddacba1b4f /pki/base/util/test/com/netscape/security/util/IA5StringTest.java | |
parent | edcb24f65cc3700e75d0a1d14dc2483f210b0ee4 (diff) | |
download | pki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.tar.gz pki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.tar.xz pki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.zip |
Formatting (no line wrap in comments or code)
Diffstat (limited to 'pki/base/util/test/com/netscape/security/util/IA5StringTest.java')
-rw-r--r-- | pki/base/util/test/com/netscape/security/util/IA5StringTest.java | 102 |
1 files changed, 53 insertions, 49 deletions
diff --git a/pki/base/util/test/com/netscape/security/util/IA5StringTest.java b/pki/base/util/test/com/netscape/security/util/IA5StringTest.java index fca7f0103..dd0af242c 100644 --- a/pki/base/util/test/com/netscape/security/util/IA5StringTest.java +++ b/pki/base/util/test/com/netscape/security/util/IA5StringTest.java @@ -15,13 +15,13 @@ public class IA5StringTest { public void testEncodingEmptyString() throws Exception { String string = ""; - System.out.println("Encoding: ["+string+"]"); + System.out.println("Encoding: [" + string + "]"); byte[] expected = JSSUtil.encode(tag, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = StringTestUtil.encode(tag, string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -32,12 +32,12 @@ public class IA5StringTest { String input = ""; byte[] data = JSSUtil.encode(tag, input); - System.out.println("Decoding: ["+StringTestUtil.toString(data)+"]"); + System.out.println("Decoding: [" + StringTestUtil.toString(data) + "]"); - System.out.println(" - expected: ["+input+"]"); + System.out.println(" - expected: [" + input + "]"); String output = StringTestUtil.decode(tag, data); - System.out.println(" - actual : ["+output+"]"); + System.out.println(" - actual : [" + output + "]"); Assert.assertEquals(input, output); } @@ -46,16 +46,16 @@ public class IA5StringTest { public void testEncodingNullCharacters() throws Exception { String string = StringTestUtil.NULL_CHARS; - System.out.println("Encoding: ["+StringTestUtil.toString(string.getBytes())+"]"); + System.out.println("Encoding: [" + StringTestUtil.toString(string.getBytes()) + "]"); byte[] expected = JSSUtil.encode(tag, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = StringTestUtil.encode(tag, string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); actual = StringTestUtil.normalizeUnicode(actual); - System.out.println(" - norm. : "+StringTestUtil.toString(actual)); + System.out.println(" - norm. : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -66,12 +66,12 @@ public class IA5StringTest { String input = StringTestUtil.NULL_CHARS; byte[] data = JSSUtil.encode(tag, input); - System.out.println("Decoding: ["+StringTestUtil.toString(data)+"]"); + System.out.println("Decoding: [" + StringTestUtil.toString(data) + "]"); - System.out.println(" - expected: ["+StringTestUtil.toString(input.getBytes())+"]"); + System.out.println(" - expected: [" + StringTestUtil.toString(input.getBytes()) + "]"); String output = StringTestUtil.decode(tag, data); - System.out.println(" - actual : ["+StringTestUtil.toString(output.getBytes())+"]"); + System.out.println(" - actual : [" + StringTestUtil.toString(output.getBytes()) + "]"); Assert.assertEquals(input, output); } @@ -80,13 +80,13 @@ public class IA5StringTest { public void testEncodingPrintableCharacters() throws Exception { String string = StringTestUtil.PRINTABLE_CHARS; - System.out.println("Encoding: ["+string+"]"); + System.out.println("Encoding: [" + string + "]"); byte[] expected = JSSUtil.encode(tag, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = StringTestUtil.encode(tag, string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -97,12 +97,12 @@ public class IA5StringTest { String input = StringTestUtil.PRINTABLE_CHARS; byte[] data = JSSUtil.encode(tag, input); - System.out.println("Decoding: ["+StringTestUtil.toString(data)+"]"); + System.out.println("Decoding: [" + StringTestUtil.toString(data) + "]"); - System.out.println(" - expected: ["+input+"]"); + System.out.println(" - expected: [" + input + "]"); String output = StringTestUtil.decode(tag, data); - System.out.println(" - actual : ["+output+"]"); + System.out.println(" - actual : [" + output + "]"); Assert.assertEquals(input, output); } @@ -111,13 +111,13 @@ public class IA5StringTest { public void testEncodingNonPrintableCharacters() throws Exception { String string = StringTestUtil.NON_PRINTABLE_CHARS; - System.out.println("Encoding: ["+string+"]"); + System.out.println("Encoding: [" + string + "]"); byte[] expected = JSSUtil.encode(tag, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = StringTestUtil.encode(tag, string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -128,12 +128,12 @@ public class IA5StringTest { String input = StringTestUtil.NON_PRINTABLE_CHARS; byte[] data = JSSUtil.encode(tag, input); - System.out.println("Decoding: ["+StringTestUtil.toString(data)+"]"); + System.out.println("Decoding: [" + StringTestUtil.toString(data) + "]"); - System.out.println(" - expected: ["+input+"]"); + System.out.println(" - expected: [" + input + "]"); String output = StringTestUtil.decode(tag, data); - System.out.println(" - actual : ["+output+"]"); + System.out.println(" - actual : [" + output + "]"); Assert.assertEquals(input, output); } @@ -142,13 +142,13 @@ public class IA5StringTest { public void testEncodingControlCharacters() throws Exception { String string = StringTestUtil.CONTROL_CHARS; - System.out.println("Encoding: ["+StringTestUtil.toString(string.getBytes())+"]"); + System.out.println("Encoding: [" + StringTestUtil.toString(string.getBytes()) + "]"); byte[] expected = JSSUtil.encode(tag, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = StringTestUtil.encode(tag, string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -159,12 +159,12 @@ public class IA5StringTest { String input = StringTestUtil.CONTROL_CHARS; byte[] data = JSSUtil.encode(tag, input); - System.out.println("Decoding: ["+StringTestUtil.toString(data)+"]"); + System.out.println("Decoding: [" + StringTestUtil.toString(data) + "]"); - System.out.println(" - expected: ["+StringTestUtil.toString(input.getBytes())+"]"); + System.out.println(" - expected: [" + StringTestUtil.toString(input.getBytes()) + "]"); String output = StringTestUtil.decode(tag, data); - System.out.println(" - actual : ["+StringTestUtil.toString(output.getBytes())+"]"); + System.out.println(" - actual : [" + StringTestUtil.toString(output.getBytes()) + "]"); Assert.assertEquals(input, output); } @@ -173,18 +173,18 @@ public class IA5StringTest { public void testEncodingMultibyteCharacters() throws Exception { String string = StringTestUtil.MULTIBYTE_CHARS; - System.out.println("Encoding: ["+string+"]"); + System.out.println("Encoding: [" + string + "]"); System.out.println(" - expected: IOException"); try { byte[] actual = StringTestUtil.encode(tag, string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.fail(); } catch (Exception e) { - System.out.println(" - actual : "+e.getClass().getSimpleName()); + System.out.println(" - actual : " + e.getClass().getSimpleName()); Assert.assertTrue(e instanceof IOException); } } @@ -195,18 +195,18 @@ public class IA5StringTest { String input = StringTestUtil.MULTIBYTE_CHARS; byte[] data = JSSUtil.encode(DerValue.tag_UTF8String, input); - System.out.println("Decoding: ["+StringTestUtil.toString(data)+"]"); + System.out.println("Decoding: [" + StringTestUtil.toString(data) + "]"); System.out.println(" - expected: IOException"); try { String output = StringTestUtil.decode(tag, data); - System.out.println(" - actual : ["+StringTestUtil.toString(output.getBytes())+"]"); + System.out.println(" - actual : [" + StringTestUtil.toString(output.getBytes()) + "]"); Assert.fail(); } catch (Exception e) { - System.out.println(" - actual : "+e.getClass().getSimpleName()); + System.out.println(" - actual : " + e.getClass().getSimpleName()); Assert.assertTrue(e instanceof IOException); } } @@ -217,24 +217,26 @@ public class IA5StringTest { System.out.println("Encoding time:"); String string = StringTestUtil.NULL_CHARS + - StringTestUtil.PRINTABLE_CHARS + - StringTestUtil.NON_PRINTABLE_CHARS + - StringTestUtil.CONTROL_CHARS; + StringTestUtil.PRINTABLE_CHARS + + StringTestUtil.NON_PRINTABLE_CHARS + + StringTestUtil.CONTROL_CHARS; long t0 = System.currentTimeMillis(); - for (int i=0; i<10000; i++) JSSUtil.encode(tag, string); + for (int i = 0; i < 10000; i++) + JSSUtil.encode(tag, string); long t1 = System.currentTimeMillis(); - for (int i=0; i<10000; i++) StringTestUtil.encode(tag, string); + for (int i = 0; i < 10000; i++) + StringTestUtil.encode(tag, string); long t2 = System.currentTimeMillis(); long time1 = t1 - t0; long time2 = t2 - t1; - System.out.println(" - JSS : "+time1+" ms"); + System.out.println(" - JSS : " + time1 + " ms"); System.out.println(" - Internal: " + time2 + " ms"); } @@ -244,26 +246,28 @@ public class IA5StringTest { System.out.println("Decoding time:"); String string = StringTestUtil.NULL_CHARS + - StringTestUtil.PRINTABLE_CHARS + - StringTestUtil.NON_PRINTABLE_CHARS + - StringTestUtil.CONTROL_CHARS; + StringTestUtil.PRINTABLE_CHARS + + StringTestUtil.NON_PRINTABLE_CHARS + + StringTestUtil.CONTROL_CHARS; byte[] data = JSSUtil.encode(tag, string); long t0 = System.currentTimeMillis(); - for (int i=0; i<10000; i++) JSSUtil.decode(tag, data); + for (int i = 0; i < 10000; i++) + JSSUtil.decode(tag, data); long t1 = System.currentTimeMillis(); - for (int i=0; i<10000; i++) StringTestUtil.decode(tag, data); + for (int i = 0; i < 10000; i++) + StringTestUtil.decode(tag, data); long t2 = System.currentTimeMillis(); long time1 = t1 - t0; long time2 = t2 - t1; - System.out.println(" - JSS : "+time1+" ms"); + System.out.println(" - JSS : " + time1 + " ms"); System.out.println(" - Internal: " + time2 + " ms"); } } |