@Test(groups = {"functional.encode", "service.lsm"}) public void testEncode() throws Exception { byte[] data = getEncodedData(); DeferredLocationEventTypeImpl deferredLocationEventType = new DeferredLocationEventTypeImpl(false, true, false, true); // boolean msAvailable, boolean enteringIntoArea, boolean leavingFromArea, boolean // beingInsideArea ISDNAddressStringImpl networkNodeNumber = new ISDNAddressStringImpl( AddressNature.international_number, NumberingPlan.ISDN, "330044005500"); LCSLocationInfoImpl lcsLocationInfo = new LCSLocationInfoImpl(networkNodeNumber, null, null, false, null, null, null, null, null); DeferredmtlrDataImpl imp = new DeferredmtlrDataImpl( deferredLocationEventType, TerminationCause.mtlrRestart, lcsLocationInfo); // DeferredLocationEventType deferredLocationEventType, TerminationCause terminationCause, // LCSLocationInfo // lcsLocationInfo AsnOutputStream asnOS = new AsnOutputStream(); imp.encodeAll(asnOS); byte[] encodedData = asnOS.toByteArray(); assertTrue(Arrays.equals(data, encodedData)); }
@Test(groups = {"functional.decode", "service.lsm"}) public void testDecode() throws Exception { byte[] data = getEncodedData(); AsnInputStream asn = new AsnInputStream(data); int tag = asn.readTag(); assertEquals(tag, Tag.SEQUENCE); DeferredmtlrDataImpl imp = new DeferredmtlrDataImpl(); imp.decodeAll(asn); assertFalse(imp.getDeferredLocationEventType().getMsAvailable()); assertTrue(imp.getDeferredLocationEventType().getEnteringIntoArea()); assertFalse(imp.getDeferredLocationEventType().getLeavingFromArea()); assertTrue(imp.getDeferredLocationEventType().getBeingInsideArea()); assertEquals(imp.getTerminationCause(), TerminationCause.mtlrRestart); assertTrue(imp.getLCSLocationInfo().getNetworkNodeNumber().getAddress().equals("330044005500")); }