diff options
Diffstat (limited to 'pki/base/util/test')
13 files changed, 285 insertions, 283 deletions
diff --git a/pki/base/util/test/com/netscape/security/extensions/GenericASN1ExtensionTest.java b/pki/base/util/test/com/netscape/security/extensions/GenericASN1ExtensionTest.java index cc2f24c3..5364931d 100644 --- a/pki/base/util/test/com/netscape/security/extensions/GenericASN1ExtensionTest.java +++ b/pki/base/util/test/com/netscape/security/extensions/GenericASN1ExtensionTest.java @@ -12,7 +12,7 @@ import org.junit.Test; public class GenericASN1ExtensionTest { - //@Test + // @Test public void testConstructorArgs() throws Exception { String name1 = "testExtension1"; String oid1 = "1.2.3.4"; @@ -44,7 +44,7 @@ public class GenericASN1ExtensionTest { GenericASN1Extension extension1 = new GenericASN1Extension(config); Assert.assertEquals(name1, extension1.getName()); - //Assert.assertNotNull(OIDMap.getClass(name1)); + // Assert.assertNotNull(OIDMap.getClass(name1)); String name2 = "testExtension2"; String oid2 = "2.4.6.8"; @@ -53,11 +53,11 @@ public class GenericASN1ExtensionTest { GenericASN1Extension extension2 = new GenericASN1Extension(config); Assert.assertEquals(name2, extension2.getName()); - //Assert.assertNotNull(OIDMap.getClass(name2)); + // Assert.assertNotNull(OIDMap.getClass(name2)); OutputStream outputStream = new ByteArrayOutputStream(); - extension1.encode(outputStream ); - extension2.encode(outputStream ); - + extension1.encode(outputStream); + extension2.encode(outputStream); + } @Test @@ -66,7 +66,7 @@ public class GenericASN1ExtensionTest { GenericASN1Extension extension = new GenericASN1Extension(true, value); OutputStream outputStream = new ByteArrayOutputStream(); - extension.encode(outputStream ); - + extension.encode(outputStream); + } } diff --git a/pki/base/util/test/com/netscape/security/util/BMPStringTest.java b/pki/base/util/test/com/netscape/security/util/BMPStringTest.java index e1dcb659..f3414f22 100644 --- a/pki/base/util/test/com/netscape/security/util/BMPStringTest.java +++ b/pki/base/util/test/com/netscape/security/util/BMPStringTest.java @@ -13,13 +13,13 @@ public class BMPStringTest { 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); } @@ -30,12 +30,12 @@ public class BMPStringTest { 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); } @@ -44,16 +44,16 @@ public class BMPStringTest { 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)); actual = StringTestUtil.normalizeUnicode(actual); - System.out.println(" - norm. : "+StringTestUtil.toString(actual)); + System.out.println(" - norm. : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -64,12 +64,12 @@ public class BMPStringTest { 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); } @@ -78,16 +78,16 @@ public class BMPStringTest { 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)); actual = StringTestUtil.normalizeUnicode(actual); - System.out.println(" - norm. : "+StringTestUtil.toString(actual)); + System.out.println(" - norm. : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -98,12 +98,12 @@ public class BMPStringTest { 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); } @@ -112,16 +112,16 @@ public class BMPStringTest { 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)); actual = StringTestUtil.normalizeUnicode(actual); - System.out.println(" - norm. : "+StringTestUtil.toString(actual)); + System.out.println(" - norm. : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -132,12 +132,12 @@ public class BMPStringTest { 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); } @@ -146,16 +146,16 @@ public class BMPStringTest { public void testEncodingMultibyteCharacters() throws Exception { String string = StringTestUtil.MULTIBYTE_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)); actual = StringTestUtil.normalizeUnicode(actual); - System.out.println(" - norm. : "+StringTestUtil.toString(actual)); + System.out.println(" - norm. : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -166,12 +166,12 @@ public class BMPStringTest { String input = StringTestUtil.MULTIBYTE_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); } 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 f101e549..73131d42 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,13 +46,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); } @@ -63,12 +63,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); } @@ -77,13 +77,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); } @@ -94,12 +94,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); } @@ -108,13 +108,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); } @@ -125,12 +125,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); } @@ -139,18 +139,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); } } @@ -161,18 +161,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); } } diff --git a/pki/base/util/test/com/netscape/security/util/JSSUtil.java b/pki/base/util/test/com/netscape/security/util/JSSUtil.java index abaab427..067de040 100644 --- a/pki/base/util/test/com/netscape/security/util/JSSUtil.java +++ b/pki/base/util/test/com/netscape/security/util/JSSUtil.java @@ -17,26 +17,26 @@ public class JSSUtil { ASN1Value value; switch (tag) { - case DerValue.tag_BMPString: - value = new BMPString(string); - break; - case DerValue.tag_IA5String: - value = new IA5String(string); - break; - case DerValue.tag_PrintableString: - value = new PrintableString(string); - break; - case DerValue.tag_T61String: - value = new TeletexString(string); - break; - case DerValue.tag_UniversalString: - value = new UniversalString(string); - break; - case DerValue.tag_UTF8String: - value = new UTF8String(string); - break; - default: - throw new Exception("Unsupported tag: "+tag); + case DerValue.tag_BMPString: + value = new BMPString(string); + break; + case DerValue.tag_IA5String: + value = new IA5String(string); + break; + case DerValue.tag_PrintableString: + value = new PrintableString(string); + break; + case DerValue.tag_T61String: + value = new TeletexString(string); + break; + case DerValue.tag_UniversalString: + value = new UniversalString(string); + break; + case DerValue.tag_UTF8String: + value = new UTF8String(string); + break; + default: + throw new Exception("Unsupported tag: " + tag); } return ASN1Util.encode(value); } diff --git a/pki/base/util/test/com/netscape/security/util/PrintableStringTest.java b/pki/base/util/test/com/netscape/security/util/PrintableStringTest.java index 4d0bc2cb..194bc2f7 100644 --- a/pki/base/util/test/com/netscape/security/util/PrintableStringTest.java +++ b/pki/base/util/test/com/netscape/security/util/PrintableStringTest.java @@ -15,13 +15,13 @@ public class PrintableStringTest { 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 PrintableStringTest { 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,13 +46,13 @@ public class PrintableStringTest { 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); } @@ -63,12 +63,12 @@ public class PrintableStringTest { 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); } @@ -77,18 +77,18 @@ public class PrintableStringTest { public void testEncodingNonPrintableCharacters() throws Exception { String string = StringTestUtil.NON_PRINTABLE_CHARS; - System.out.println("Encoding: ["+StringTestUtil.toString(string.getBytes())+"]"); + System.out.println("Encoding: [" + StringTestUtil.toString(string.getBytes()) + "]"); 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); } } @@ -99,18 +99,18 @@ public class PrintableStringTest { String input = StringTestUtil.NON_PRINTABLE_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); } } @@ -119,18 +119,18 @@ public class PrintableStringTest { 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()) + "]"); 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); } } @@ -141,18 +141,18 @@ public class PrintableStringTest { String input = StringTestUtil.CONTROL_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); } } @@ -161,18 +161,18 @@ public class PrintableStringTest { 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, StringTestUtil.MULTIBYTE_CHARS); - 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); } } @@ -183,18 +183,18 @@ public class PrintableStringTest { 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); } } diff --git a/pki/base/util/test/com/netscape/security/util/StringTestUtil.java b/pki/base/util/test/com/netscape/security/util/StringTestUtil.java index 211ba518..06dc10ea 100644 --- a/pki/base/util/test/com/netscape/security/util/StringTestUtil.java +++ b/pki/base/util/test/com/netscape/security/util/StringTestUtil.java @@ -7,7 +7,7 @@ import netscape.security.util.DerValue; public class StringTestUtil { public final static String PRINTABLE_CHARS = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 \'()+,-./:=?"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 \'()+,-./:=?"; public final static String NON_PRINTABLE_CHARS = "\"\\"; @@ -18,8 +18,9 @@ public class StringTestUtil { public static String toString(byte[] array) { StringBuffer sb = new StringBuffer(); - for (int i=0; i<array.length; i++) { - if (i > 0) sb.append(" "); + for (int i = 0; i < array.length; i++) { + if (i > 0) + sb.append(" "); sb.append(Integer.toHexString(0xff & array[i] | 0x100).substring(1).toUpperCase()); } @@ -31,13 +32,14 @@ public class StringTestUtil { DerValue value = new DerValue(data); byte[] tmp = value.data.toByteArray(); - if (tmp[0] == -2 && tmp[1] == -1) { // remove optional big-endian byte-order mark + if (tmp[0] == -2 && tmp[1] == -1) { // remove optional big-endian + // byte-order mark byte tag = value.tag; int length = value.length() - 2; DerOutputStream os = new DerOutputStream(); - os.putTag((byte)0, false, tag); + os.putTag((byte) 0, false, tag); os.putLength(length); os.write(tmp, 2, length); @@ -70,7 +72,7 @@ public class StringTestUtil { case DerValue.tag_UTF8String: return is.getDerValue().getUTF8String(); default: - throw new Exception("Unsupported tag: "+tag); + throw new Exception("Unsupported tag: " + tag); } } } diff --git a/pki/base/util/test/com/netscape/security/util/TeletexStringTest.java b/pki/base/util/test/com/netscape/security/util/TeletexStringTest.java index 7217cae4..d6ce1cac 100644 --- a/pki/base/util/test/com/netscape/security/util/TeletexStringTest.java +++ b/pki/base/util/test/com/netscape/security/util/TeletexStringTest.java @@ -15,13 +15,13 @@ public class TeletexStringTest { 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 TeletexStringTest { 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,13 +46,13 @@ public class TeletexStringTest { 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); } @@ -63,12 +63,12 @@ public class TeletexStringTest { 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); } @@ -77,13 +77,13 @@ public class TeletexStringTest { 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); } @@ -94,12 +94,12 @@ public class TeletexStringTest { 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); } @@ -108,13 +108,13 @@ public class TeletexStringTest { 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); } @@ -125,12 +125,12 @@ public class TeletexStringTest { 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); } @@ -139,18 +139,18 @@ public class TeletexStringTest { 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); } } @@ -161,18 +161,18 @@ public class TeletexStringTest { 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); } } diff --git a/pki/base/util/test/com/netscape/security/util/UTF8StringTest.java b/pki/base/util/test/com/netscape/security/util/UTF8StringTest.java index 3256a8e3..f4ccd8c7 100644 --- a/pki/base/util/test/com/netscape/security/util/UTF8StringTest.java +++ b/pki/base/util/test/com/netscape/security/util/UTF8StringTest.java @@ -13,13 +13,13 @@ public class UTF8StringTest { public void testEncodingEmptyString() throws Exception { String string = ""; - System.out.println("Encoding: ["+string+"]"); + System.out.println("Encoding: [" + string + "]"); byte[] expected = JSSUtil.encode(tag, ""); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = StringTestUtil.encode(tag, ""); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -30,12 +30,12 @@ public class UTF8StringTest { 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); } @@ -44,13 +44,13 @@ public class UTF8StringTest { 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); } @@ -61,12 +61,12 @@ public class UTF8StringTest { 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); } @@ -75,13 +75,13 @@ public class UTF8StringTest { 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); } @@ -92,12 +92,12 @@ public class UTF8StringTest { 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); } @@ -106,13 +106,13 @@ public class UTF8StringTest { 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); } @@ -123,12 +123,12 @@ public class UTF8StringTest { 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); } @@ -137,13 +137,13 @@ public class UTF8StringTest { public void testEncodingMultibyteCharacters() throws Exception { String string = StringTestUtil.MULTIBYTE_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); } @@ -154,12 +154,12 @@ public class UTF8StringTest { String input = StringTestUtil.MULTIBYTE_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); } diff --git a/pki/base/util/test/com/netscape/security/util/UniversalStringTest.java b/pki/base/util/test/com/netscape/security/util/UniversalStringTest.java index aceae03b..d3e35d6e 100644 --- a/pki/base/util/test/com/netscape/security/util/UniversalStringTest.java +++ b/pki/base/util/test/com/netscape/security/util/UniversalStringTest.java @@ -13,13 +13,13 @@ public class UniversalStringTest { 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); } @@ -30,12 +30,12 @@ public class UniversalStringTest { 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); } @@ -44,13 +44,13 @@ public class UniversalStringTest { 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); } @@ -61,12 +61,12 @@ public class UniversalStringTest { 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); } @@ -75,13 +75,13 @@ public class UniversalStringTest { 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); } @@ -92,12 +92,12 @@ public class UniversalStringTest { 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); } @@ -106,13 +106,13 @@ public class UniversalStringTest { 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); } @@ -123,12 +123,12 @@ public class UniversalStringTest { 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); } @@ -137,13 +137,13 @@ public class UniversalStringTest { public void testEncodingMultibyteCharacters() throws Exception { String string = StringTestUtil.MULTIBYTE_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); } @@ -154,12 +154,12 @@ public class UniversalStringTest { String input = StringTestUtil.MULTIBYTE_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); } diff --git a/pki/base/util/test/com/netscape/security/x509/DirStrConverterTest.java b/pki/base/util/test/com/netscape/security/x509/DirStrConverterTest.java index ec8ddc51..7b5cea9c 100644 --- a/pki/base/util/test/com/netscape/security/x509/DirStrConverterTest.java +++ b/pki/base/util/test/com/netscape/security/x509/DirStrConverterTest.java @@ -15,13 +15,13 @@ public class DirStrConverterTest { public void testEmptyString() throws Exception { String string = ""; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_PrintableString, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new DirStrConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -30,13 +30,13 @@ public class DirStrConverterTest { public void testPrintableCharacters() throws Exception { String string = StringTestUtil.PRINTABLE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_PrintableString, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new DirStrConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -45,13 +45,13 @@ public class DirStrConverterTest { public void testControlCharacters() throws Exception { String string = StringTestUtil.CONTROL_CHARS; - System.out.println("Converting: ["+StringTestUtil.toString(string.getBytes())+"]"); + System.out.println("Converting: [" + StringTestUtil.toString(string.getBytes()) + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_T61String, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new DirStrConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -60,13 +60,13 @@ public class DirStrConverterTest { public void testMultibyteCharacters() throws Exception { String string = StringTestUtil.MULTIBYTE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_UniversalString, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new DirStrConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -75,15 +75,15 @@ public class DirStrConverterTest { public void testPrintableCharactersWithTags() throws Exception { String string = StringTestUtil.PRINTABLE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_IA5String, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new DirStrConverter(), string, new byte[] { - DerValue.tag_IA5String, DerValue.tag_UTF8String + DerValue.tag_IA5String, DerValue.tag_UTF8String }); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -92,15 +92,15 @@ public class DirStrConverterTest { public void testMultibyteCharactersWithTags() throws Exception { String string = StringTestUtil.MULTIBYTE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_UTF8String, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new DirStrConverter(), string, new byte[] { - DerValue.tag_IA5String, DerValue.tag_UTF8String + DerValue.tag_IA5String, DerValue.tag_UTF8String }); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } diff --git a/pki/base/util/test/com/netscape/security/x509/GenericValueConverterTest.java b/pki/base/util/test/com/netscape/security/x509/GenericValueConverterTest.java index bee2b241..e9bd1658 100644 --- a/pki/base/util/test/com/netscape/security/x509/GenericValueConverterTest.java +++ b/pki/base/util/test/com/netscape/security/x509/GenericValueConverterTest.java @@ -15,13 +15,13 @@ public class GenericValueConverterTest { public void testEmptyString() throws Exception { String string = ""; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_PrintableString, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new GenericValueConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -30,13 +30,13 @@ public class GenericValueConverterTest { public void testPrintableCharacters() throws Exception { String string = StringTestUtil.PRINTABLE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_PrintableString, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new GenericValueConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -45,13 +45,13 @@ public class GenericValueConverterTest { public void testControlCharacters() throws Exception { String string = StringTestUtil.CONTROL_CHARS; - System.out.println("Converting: ["+StringTestUtil.toString(string.getBytes())+"]"); + System.out.println("Converting: [" + StringTestUtil.toString(string.getBytes()) + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_IA5String, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new GenericValueConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -60,16 +60,16 @@ public class GenericValueConverterTest { public void testMultibyteCharacters() throws Exception { String string = StringTestUtil.MULTIBYTE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_BMPString, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new GenericValueConverter(), 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); } @@ -78,15 +78,15 @@ public class GenericValueConverterTest { public void testPrintableCharactersWithTags() throws Exception { String string = StringTestUtil.PRINTABLE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_T61String, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new GenericValueConverter(), string, new byte[] { - DerValue.tag_T61String, DerValue.tag_UniversalString + DerValue.tag_T61String, DerValue.tag_UniversalString }); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -95,15 +95,15 @@ public class GenericValueConverterTest { public void testMultibyteCharactersWithTags() throws Exception { String string = StringTestUtil.MULTIBYTE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_UniversalString, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new GenericValueConverter(), string, new byte[] { - DerValue.tag_T61String, DerValue.tag_UniversalString + DerValue.tag_T61String, DerValue.tag_UniversalString }); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } diff --git a/pki/base/util/test/com/netscape/security/x509/IA5StringConverterTest.java b/pki/base/util/test/com/netscape/security/x509/IA5StringConverterTest.java index 682e7384..e44f99ab 100644 --- a/pki/base/util/test/com/netscape/security/x509/IA5StringConverterTest.java +++ b/pki/base/util/test/com/netscape/security/x509/IA5StringConverterTest.java @@ -15,13 +15,13 @@ public class IA5StringConverterTest { public void testEmptyString() throws Exception { String string = ""; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_IA5String, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new IA5StringConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -30,13 +30,13 @@ public class IA5StringConverterTest { public void testPrintableCharacters() throws Exception { String string = StringTestUtil.PRINTABLE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_IA5String, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new IA5StringConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -45,13 +45,13 @@ public class IA5StringConverterTest { public void testControlCharacters() throws Exception { String string = StringTestUtil.CONTROL_CHARS; - System.out.println("Converting: ["+StringTestUtil.toString(string.getBytes())+"]"); + System.out.println("Converting: [" + StringTestUtil.toString(string.getBytes()) + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_IA5String, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new IA5StringConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -60,18 +60,18 @@ public class IA5StringConverterTest { public void testMultibyteCharacters() throws Exception { String string = StringTestUtil.MULTIBYTE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); System.out.println(" - expected: IllegalArgumentException"); try { byte[] actual = ConverterTestUtil.convert(new IA5StringConverter(), 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 IllegalArgumentException); } } diff --git a/pki/base/util/test/com/netscape/security/x509/PrintableConverterTest.java b/pki/base/util/test/com/netscape/security/x509/PrintableConverterTest.java index acaa5c1b..cd578c04 100644 --- a/pki/base/util/test/com/netscape/security/x509/PrintableConverterTest.java +++ b/pki/base/util/test/com/netscape/security/x509/PrintableConverterTest.java @@ -15,13 +15,13 @@ public class PrintableConverterTest { public void testEmptyString() throws Exception { String string = ""; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_PrintableString, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new PrintableConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -30,13 +30,13 @@ public class PrintableConverterTest { public void testPrintableCharacters() throws Exception { String string = StringTestUtil.PRINTABLE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); byte[] expected = JSSUtil.encode(DerValue.tag_PrintableString, string); - System.out.println(" - expected: "+StringTestUtil.toString(expected)); + System.out.println(" - expected: " + StringTestUtil.toString(expected)); byte[] actual = ConverterTestUtil.convert(new PrintableConverter(), string); - System.out.println(" - actual : "+StringTestUtil.toString(actual)); + System.out.println(" - actual : " + StringTestUtil.toString(actual)); Assert.assertArrayEquals(expected, actual); } @@ -45,18 +45,18 @@ public class PrintableConverterTest { public void testControlCharacters() throws Exception { String string = StringTestUtil.CONTROL_CHARS; - System.out.println("Converting: ["+StringTestUtil.toString(string.getBytes())+"]"); + System.out.println("Converting: [" + StringTestUtil.toString(string.getBytes()) + "]"); System.out.println(" - expected: IllegalArgumentException"); try { byte[] actual = ConverterTestUtil.convert(new PrintableConverter(), 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 IllegalArgumentException); } } @@ -65,18 +65,18 @@ public class PrintableConverterTest { public void testMultibyteCharacters() throws Exception { String string = StringTestUtil.MULTIBYTE_CHARS; - System.out.println("Converting: ["+string+"]"); + System.out.println("Converting: [" + string + "]"); System.out.println(" - expected: IllegalArgumentException"); try { byte[] actual = ConverterTestUtil.convert(new PrintableConverter(), 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 IllegalArgumentException); } } |