### Question:
LMAlgoFactoryDecorator implements RoutingAlgorithmFactoryDecorator { public LMAlgoFactoryDecorator addWeighting(String weighting) { String str[] = weighting.split("\\|"); double value = -1; if (str.length > 1) { PMap map = new PMap(weighting); value = map.getDouble("maximum", -1); } weightingsAsStrings.add(str[0]); maximumWeights.put(str[0], value); return this; } LMAlgoFactoryDecorator(); @Override void init(CmdArgs args); int getLandmarks(); LMAlgoFactoryDecorator setDisablingAllowed(boolean disablingAllowed); final boolean isDisablingAllowed(); final LMAlgoFactoryDecorator setEnabled(boolean enabled); @Override final boolean isEnabled(); int getPreparationThreads(); void setPreparationThreads(int preparationThreads); LMAlgoFactoryDecorator setWeightingsAsStrings(List<String> weightingList); List<String> getWeightingsAsStrings(); LMAlgoFactoryDecorator addWeighting(String weighting); LMAlgoFactoryDecorator addWeighting(Weighting weighting); LMAlgoFactoryDecorator addPreparation(PrepareLandmarks pch); boolean hasWeightings(); boolean hasPreparations(); int size(); List<Weighting> getWeightings(); List<PrepareLandmarks> getPreparations(); @Override RoutingAlgorithmFactory getDecoratedAlgorithmFactory(RoutingAlgorithmFactory defaultAlgoFactory, HintsMap map); boolean loadOrDoWork(final StorableProperties properties); void createPreparations(GraphHopperStorage ghStorage, LocationIndex locationIndex);  }### Answer:
@Test public void addWeighting() { LMAlgoFactoryDecorator dec = new LMAlgoFactoryDecorator().setEnabled(true); dec.addWeighting("fastest"); assertEquals(Arrays.asList("fastest"), dec.getWeightingsAsStrings()); dec = new LMAlgoFactoryDecorator().setEnabled(true); dec.addWeighting("fastest|maximum=65000"); dec.addWeighting("shortest|maximum=20000"); assertEquals(Arrays.asList("fastest", "shortest"), dec.getWeightingsAsStrings()); FlagEncoder car = new CarFlagEncoder(); EncodingManager em = new EncodingManager(car); dec.addWeighting(new FastestWeighting(car)).addWeighting(new ShortestWeighting(car)); dec.createPreparations(new GraphHopperStorage(new RAMDirectory(), em, false, new GraphExtension.NoOpExtension()), null); assertEquals(1, dec.getPreparations().get(0).getLandmarkStorage().getFactor(), .1); assertEquals(0.3, dec.getPreparations().get(1).getLandmarkStorage().getFactor(), .1); }