Exemplo n.º 1
0
  @Test(groups = {"functional.decode", "primitives"})
  public void testDecode() throws Exception {

    byte[] data = this.getData1();

    AsnInputStream asn = new AsnInputStream(data);
    int tag = asn.readTag();

    LocationAreaImpl prim = new LocationAreaImpl();
    prim.decodeAll(asn);

    assertEquals(tag, LocationAreaImpl._TAG_laiFixedLength);
    assertEquals(asn.getTagClass(), Tag.CLASS_CONTEXT_SPECIFIC);

    LAIFixedLength lai = prim.getLAIFixedLength();
    assertEquals(lai.getMCC(), 249);
    assertEquals(lai.getMNC(), 1);
    assertEquals(lai.getLac(), 14010);
    assertNull(prim.getLAC());

    data = this.getData2();

    asn = new AsnInputStream(data);
    tag = asn.readTag();

    prim = new LocationAreaImpl();
    prim.decodeAll(asn);

    assertEquals(tag, LocationAreaImpl._TAG_lac);
    assertEquals(asn.getTagClass(), Tag.CLASS_CONTEXT_SPECIFIC);

    assertNull(prim.getLAIFixedLength());
    LAC lac = prim.getLAC();
    assertEquals(lac.getLac(), 14010);
  }
Exemplo n.º 2
0
  @Test(groups = {"functional.decode", "primitives"})
  public void testEncode() throws Exception {

    LAIFixedLengthImpl lai = new LAIFixedLengthImpl(249, 1, 14010);
    LocationAreaImpl prim = new LocationAreaImpl(lai);

    AsnOutputStream asn = new AsnOutputStream();
    prim.encodeAll(asn);

    assertTrue(Arrays.equals(asn.toByteArray(), this.getData1()));

    LAC lac = new LACImpl(14010);
    prim = new LocationAreaImpl(lac);

    asn = new AsnOutputStream();
    prim.encodeAll(asn);

    assertTrue(Arrays.equals(asn.toByteArray(), this.getData2()));
  }