@Test(dependsOnMethods = {"testValidData"}) public final void testValidDataBase64() { ByteArray validBinLoc = new ByteArray(Base64 .encodeBase64String(VALID_BIN_DATA_POS_OFFSET_V2)); RawLocationReference decodeData = null; try { decodeData = decodeData(validBinLoc); } catch (PhysicalFormatException e) { fail("failed on valid input", e); } List<? extends LocationReferencePoint> b64Points = decodeData .getLocationReferencePoints(); List<? extends LocationReferencePoint> templateLRPs = validDecodeLocation .getLocationReferencePoints(); LocationReferencePoint currentPoint; LocationReferencePoint currentB64Point; for (int i = 0; i < templateLRPs.size(); i++) { currentPoint = templateLRPs.get(i); currentB64Point = b64Points.get(i); assertEquals(currentPoint.getBearing(), currentB64Point .getBearing()); assertEquals(currentPoint.getDistanceToNext(), currentB64Point .getDistanceToNext()); assertEquals(currentPoint.getFOW(), currentB64Point.getFOW()); assertEquals(currentPoint.getFRC(), currentB64Point.getFRC()); assertEquals(currentPoint.getLatitudeDeg(), currentB64Point .getLatitudeDeg()); assertEquals(currentPoint.getLongitudeDeg(), currentB64Point .getLongitudeDeg()); assertEquals(currentPoint.getLfrc(), currentB64Point.getLfrc()); } Offsets b64Offset = decodeData.getOffsets(); Offsets templateOffsets = validDecodeLocation.getOffsets(); assertEquals(templateOffsets.hasPositiveOffset(), b64Offset .hasPositiveOffset()); assertEquals(templateOffsets.hasNegativeOffset(), b64Offset .hasNegativeOffset()); assertEquals(templateOffsets.getPositiveOffset(0), b64Offset .getPositiveOffset(0)); assertEquals(templateOffsets.getNegativeOffset(0), b64Offset .getNegativeOffset(0)); }
@Override public RawLocationReference decodeData(final LocationReference lr) throws PhysicalFormatException { Object data = lr.getLocationReferenceData(); if (data == null || !(data instanceof ByteArray)) { throw new OpenLRBinaryException( PhysicalFormatError.INVALID_BINARY_DATA); } ByteArray dataList = (ByteArray) data; return parseBinaryData(lr.getID(), dataList.getData(), null); }
OpenLRBinaryDecoder implements PhysicalDecoder { @Override public RawLocationReference decodeData(final LocationReference lr) throws PhysicalFormatException { Object data = lr.getLocationReferenceData(); if (data == null || !(data instanceof ByteArray)) { throw new OpenLRBinaryException( PhysicalFormatError.INVALID_BINARY_DATA); } ByteArray dataList = (ByteArray) data; return parseBinaryData(lr.getID(), dataList.getData(), null); } }
OpenLRBinaryDecoder implements PhysicalDecoder { @Override public RawLocationReference decodeData(final LocationReference lr) throws PhysicalFormatException { Object data = lr.getLocationReferenceData(); if (data == null || !(data instanceof ByteArray)) { throw new OpenLRBinaryException( PhysicalFormatError.INVALID_BINARY_DATA); } ByteArray dataList = (ByteArray) data; return parseBinaryData(lr.getID(), dataList.getData(), null); }  }
OpenLRBinaryDecoder implements PhysicalDecoder { @Override public RawLocationReference decodeData(final LocationReference lr) throws PhysicalFormatException { Object data = lr.getLocationReferenceData(); if (data == null || !(data instanceof ByteArray)) { throw new OpenLRBinaryException( PhysicalFormatError.INVALID_BINARY_DATA); } ByteArray dataList = (ByteArray) data; return parseBinaryData(lr.getID(), dataList.getData(), null); }  static int[] getVersions(); @Override RawLocationReference decodeData(final LocationReference lr); @Override Class<?> getDataClass(); @Override String getDataFormatIdentifier(); RawBinaryData resolveBinaryData(final String id, final ByteArray ba); }
OpenLRBinaryDecoder implements PhysicalDecoder { @Override public RawLocationReference decodeData(final LocationReference lr) throws PhysicalFormatException { Object data = lr.getLocationReferenceData(); if (data == null || !(data instanceof ByteArray)) { throw new OpenLRBinaryException( PhysicalFormatError.INVALID_BINARY_DATA); } ByteArray dataList = (ByteArray) data; return parseBinaryData(lr.getID(), dataList.getData(), null); }  static int[] getVersions(); @Override RawLocationReference decodeData(final LocationReference lr); @Override Class<?> getDataClass(); @Override String getDataFormatIdentifier(); RawBinaryData resolveBinaryData(final String id, final ByteArray ba);  }