OpenLRProtoEncoder implements PhysicalEncoder { @Override public LocationReference encodeData(RawLocationReference rawLocRef) { LocationReferenceEncoder locationReferenceEncoder = locationTypeEncoderRegistry.getEncoder(rawLocRef.getLocationType()); if (locationReferenceEncoder == null) { return new LocationReferenceProtoImpl( rawLocRef.getID(), rawLocRef.getLocationType(), OpenLRProtoStatusCode.UNSUPPORTED_LOCATION_TYPE); } try { return locationReferenceEncoder.encode(rawLocRef); } catch (OpenLRProtoException e) { return new LocationReferenceProtoImpl( rawLocRef.getID(), rawLocRef.getLocationType(), e.getErrorCode()); } }  @Override LocationReference encodeData(RawLocationReference rawLocRef); @Override LocationReference encodeData(RawLocationReference rawLocRef, int version); @Override int[] getSupportedVersions(); @Override String getDataFormatIdentifier(); @Override Class<?> getDataClass();  }
@Test public void testUnsupportedLocationType() { GeoCoordinates geoCoordinates = new GeoCoordinatesProtoImpl(1, 2); RawCircleLocRef rawLocationReference = new RawCircleLocRef("1", geoCoordinates, 100); LocationReference locationReference = openLREncoder.encodeData(rawLocationReference); assertFalse(locationReference.isValid()); assertEquals(locationReference.getReturnCode(), OpenLRProtoStatusCode.UNSUPPORTED_LOCATION_TYPE); }