@Test public void convertRangeUnit() throws ParameterValueException { String unit = handler.convertRangeUnit(APIEnums.Units.KILOMETRES); Assert.assertEquals("km", unit); unit = handler.convertRangeUnit(APIEnums.Units.METRES); Assert.assertEquals("m", unit); unit = handler.convertRangeUnit(APIEnums.Units.MILES); Assert.assertEquals("mi", unit); }
String convertRangeUnit(APIEnums.Units unitsIn) throws ParameterValueException { DistanceUnit units; try { units = DistanceUnitUtil.getFromString(unitsIn.toString(), DistanceUnit.UNKNOWN); if (units == DistanceUnit.UNKNOWN) throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesRequest.PARAM_RANGE_UNITS, unitsIn.toString()); } catch (Exception e) { throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesRequest.PARAM_RANGE_UNITS, unitsIn.toString()); } return DistanceUnitUtil.toString(units); }
IsochronesRequestHandler extends GenericHandler { String convertRangeUnit(APIEnums.Units unitsIn) throws ParameterValueException { DistanceUnit units; try { units = DistanceUnitUtil.getFromString(unitsIn.toString(), DistanceUnit.UNKNOWN); if (units == DistanceUnit.UNKNOWN) throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesRequest.PARAM_RANGE_UNITS, unitsIn.toString()); } catch (Exception e) { throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesRequest.PARAM_RANGE_UNITS, unitsIn.toString()); } return DistanceUnitUtil.toString(units); } }
IsochronesRequestHandler extends GenericHandler { String convertRangeUnit(APIEnums.Units unitsIn) throws ParameterValueException { DistanceUnit units; try { units = DistanceUnitUtil.getFromString(unitsIn.toString(), DistanceUnit.UNKNOWN); if (units == DistanceUnit.UNKNOWN) throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesRequest.PARAM_RANGE_UNITS, unitsIn.toString()); } catch (Exception e) { throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesRequest.PARAM_RANGE_UNITS, unitsIn.toString()); } return DistanceUnitUtil.toString(units); } IsochronesRequestHandler(); }
IsochronesRequestHandler extends GenericHandler { String convertRangeUnit(APIEnums.Units unitsIn) throws ParameterValueException { DistanceUnit units; try { units = DistanceUnitUtil.getFromString(unitsIn.toString(), DistanceUnit.UNKNOWN); if (units == DistanceUnit.UNKNOWN) throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesRequest.PARAM_RANGE_UNITS, unitsIn.toString()); } catch (Exception e) { throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesRequest.PARAM_RANGE_UNITS, unitsIn.toString()); } return DistanceUnitUtil.toString(units); } IsochronesRequestHandler(); void generateIsochronesFromRequest(IsochronesRequest request); IsochroneMapCollection getIsoMaps(); IsochroneRequest getIsochroneRequest(); }
IsochronesRequestHandler extends GenericHandler { String convertRangeUnit(APIEnums.Units unitsIn) throws ParameterValueException { DistanceUnit units; try { units = DistanceUnitUtil.getFromString(unitsIn.toString(), DistanceUnit.UNKNOWN); if (units == DistanceUnit.UNKNOWN) throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesRequest.PARAM_RANGE_UNITS, unitsIn.toString()); } catch (Exception e) { throw new ParameterValueException(IsochronesErrorCodes.INVALID_PARAMETER_VALUE, IsochronesRequest.PARAM_RANGE_UNITS, unitsIn.toString()); } return DistanceUnitUtil.toString(units); } IsochronesRequestHandler(); void generateIsochronesFromRequest(IsochronesRequest request); IsochroneMapCollection getIsoMaps(); IsochroneRequest getIsochroneRequest();  }