package org.bouncycastle.asn1.test;

import java.io.IOException;
import java.util.Arrays;

import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.icao.CscaMasterList;
import org.bouncycastle.util.io.Streams;
import org.bouncycastle.util.test.SimpleTest;

public class CscaMasterListTest 
    extends SimpleTest
{
    public String getName()
    {
        return "CscaMasterList";
    }
    
    public void performTest() 
        throws Exception
    {
        byte[] input = getInput("masterlist-content.data");
        CscaMasterList parsedList
            = CscaMasterList.getInstance(ASN1Object.fromByteArray(input));

        if (parsedList.getCertStructs().length != 3) {
            fail("Cert structure parsing failed: incorrect length");
        }

        byte[] output = parsedList.getEncoded();
        if (!Arrays.equals(input, output)) {
            fail("Encoding failed after parse");
        }
    }

    private byte[] getInput(String name)
        throws IOException
    {
        return Streams.readAll(getClass().getResourceAsStream(name));
    }

    public static void main(
        String[]    args)
    {
        runTest(new CscaMasterListTest());
    }
}

@@ -61,33 +61,8 @@
 ion;
-%0Aimport java.util.Arrays;
 %0A%0Aim
@@ -150,16 +150,53 @@
 erList;%0A
+import org.bouncycastle.util.Arrays;%0A
 import o
@@ -306,17 +306,16 @@
 ListTest
- 
 %0A    ext
@@ -405,20 +405,16 @@
 ;%0A    %7D%0A
-    
 %0A    pub
@@ -435,17 +435,16 @@
 rmTest()
- 
 %0A       
@@ -689,16 +689,24 @@
 th != 3)
+%0A       
  %7B%0A     
@@ -853,14 +853,16 @@
 ays.
-e
+areE
 qual
-s
 (inp
@@ -873,16 +873,24 @@
 output))
+%0A       
  %7B%0A     
@@ -1130,16 +1130,16 @@
 d main(%0A
+
         
@@ -1146,19 +1146,16 @@
 String%5B%5D
-   
  args)%0A 

change java.util import to BC one.