use of com.android.internal.telephony.uicc.asn1.InvalidAsn1DataException in project android_frameworks_opt_telephony by LineageOS.
the class Asn1NodeTest method testAsBytes_ConstructedTag.
@SmallTest
@Test(expected = IllegalStateException.class)
public void testAsBytes_ConstructedTag() throws InvalidAsn1DataException {
Asn1Node node = Asn1Node.newBuilder(0xBF37).build();
node.asBytes();
}
use of com.android.internal.telephony.uicc.asn1.InvalidAsn1DataException in project android_frameworks_opt_telephony by LineageOS.
the class Asn1NodeTest method testAsLong_ConstructedTag.
@SmallTest
@Test(expected = IllegalStateException.class)
public void testAsLong_ConstructedTag() throws InvalidAsn1DataException {
Asn1Node node = Asn1Node.newBuilder(0xBF37).build();
node.asRawLong();
}
use of com.android.internal.telephony.uicc.asn1.InvalidAsn1DataException in project android_frameworks_opt_telephony by LineageOS.
the class Asn1NodeTest method testAsString_ConstructedTag.
@SmallTest
@Test(expected = IllegalStateException.class)
public void testAsString_ConstructedTag() throws InvalidAsn1DataException {
Asn1Node node = Asn1Node.newBuilder(0xBF37).build();
node.asString();
}
use of com.android.internal.telephony.uicc.asn1.InvalidAsn1DataException in project android_frameworks_opt_telephony by LineageOS.
the class Asn1NodeTest method testWriteToBytes.
@SmallTest
@Test
public void testWriteToBytes() throws InvalidAsn1DataException {
final String nodeHex = "3031110312D687120F54686973206973206120746573742E310B13040422C4F0" + "1403FF00FF1501FF13040422C4F01403FF00FF";
Asn1Node node = new Asn1Decoder(nodeHex).nextNode();
// Writes the bytes before children accessed.
assertEquals(nodeHex, node.toHex());
// Writes the bytes after children accessed.
node.getChildren();
assertEquals(nodeHex, node.toHex());
}
use of com.android.internal.telephony.uicc.asn1.InvalidAsn1DataException in project android_frameworks_opt_telephony by LineageOS.
the class Asn1NodeTest method testNonExitingChildren.
@SmallTest
@Test
public void testNonExitingChildren() throws TagNotFoundException, InvalidAsn1DataException {
Asn1Node node = Asn1Node.newBuilder(0x3F34).addChild(Asn1Node.newBuilder(0x34)).addChild(Asn1Node.newBuilder(0x35).addChild(Asn1Node.newBuilder(0x36))).addChildAsInteger(0x11, 123).build();
assertEquals(0, node.getChild(0x34).getChildren(0x37).size());
assertEquals(0, node.getChildren(0x37).size());
assertEquals(0, node.getChild(0x11).getChildren(0x37).size());
assertEquals(0, node.getChild(0x11).getChildren().size());
try {
node.getChild(0x35).getChild(0x37);
fail("0x37 should not exist.");
} catch (TagNotFoundException e) {
assertEquals(0x37, e.getTag());
}
try {
node.getChild(0x35, 0x37);
fail("0x37 should not exist.");
} catch (TagNotFoundException e) {
assertEquals(0x37, e.getTag());
}
try {
node.getChild(0x11).getChild(0x37);
fail("0x37 should not exist.");
} catch (TagNotFoundException e) {
assertEquals(0x37, e.getTag());
}
}
Aggregations