/**
* TODO Put method description here
*/
public void testDistinctTags() throws Exception {
ASN1Choice choice1 = new ASN1Choice(new ASN1Type[] {
ASN1Boolean.getInstance(),// component to be checked
ASN1Oid.getInstance(), ASN1Integer.getInstance() }) {
public Object getObjectToEncode(Object obj) {
return obj;
}
public int getIndex(Object obj) {
return 0;
}
};
// two ASN.1 booleans
try {
new ASN1Choice(new ASN1Type[] { choice1, //
ASN1Boolean.getInstance() // component to be checked
}) {
public Object getObjectToEncode(Object obj) {
return obj;
}
public int getIndex(Object obj) {
return 0;
}
};
fail("No expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
}
// ASN.1 ANY
try {
new ASN1Choice(new ASN1Type[] { choice1,//
ASN1Any.getInstance() // component to be checked
}) {
public Object getObjectToEncode(Object obj) {
return obj;
}
public int getIndex(Object obj) {
return 0;
}
};
fail("No expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
}
// two choices
ASN1Choice choice2 = new ASN1Choice(new ASN1Type[] {
ASN1BitString.getInstance(), //
ASN1Boolean.getInstance() //component to be checked
}) {
public Object getObjectToEncode(Object obj) {
return obj;
}
public int getIndex(Object obj) {
return 0;
}
};
try {
new ASN1Choice(new ASN1Type[] { choice1, choice2 }) {
public Object getObjectToEncode(Object obj) {
return obj;
}