OpenLRDatex2Encoder implements PhysicalEncoder { @Override public final LocationReference encodeData( final RawLocationReference rawLocRef) { return encodeData(rawLocRef, VERSIONS[VERSIONS.length - 1]); }  @Override final Class<?> getDataClass(); @Override final String getDataFormatIdentifier(); @Override final int[] getSupportedVersions(); @Override final LocationReference encodeData(
            final RawLocationReference rawLocRef); @Override final LocationReference encodeData(
            final RawLocationReference rawLocRef, final int version);  }
@Test public final void testBinaryEncoder05() { LocationReference ref = null; RawLocationReference rawLocRef = new RawLineLocRef("", points, off2); try { ref = XML_ENCODER.encodeData(rawLocRef, 11); XmlWriter writer = new XmlWriter(); StringWriter sw = new StringWriter(); writer.saveDatex2Location((Datex2Location) ref.getLocationReferenceData(), sw); BufferedReader br = new BufferedReader(new FileReader(TEST_DATA)); String[] lines = sw.toString().split("\n"); int nrLines = lines.length; String current = null; for (int i = 0; i < nrLines; i++) { current = br.readLine(); if (current == null) { fail("data not complete"); } if (!current.trim().equals(lines[i].trim())) { fail("data invalid"); } } if (br.readLine() != null) { fail("data not complete"); } } catch (PhysicalFormatException e) { fail("cannot encode data", e); } catch (JAXBException e) { e.printStackTrace(); fail("cannot encode data"); } catch (SAXException e) { e.printStackTrace(); fail("cannot encode data"); } catch (FileNotFoundException e) { fail("", e); } catch (IOException e) { fail("", e); } if (!"datex2".equals(ref.getDataIdentifier())) { fail("Invalid data identifier"); } }