### Question:
GraphHopper implements GraphHopperAPI { protected void prepare() { boolean tmpPrepare = doPrepare && chEnabled; if (tmpPrepare) { ensureWriteAccess(); ghStorage.freeze(); int counter = 0; for (Entry<Weighting, RoutingAlgorithmFactory> entry : algoFactories.entrySet()) { logger.info((++counter) + "/" + algoFactories.entrySet().size() + " calling prepare.doWork for " + entry.getKey() + " ... (" + Helper.getMemInfo() + ")"); if (!(entry.getValue() instanceof PrepareContractionHierarchies)) throw new IllegalStateException("RoutingAlgorithmFactory is not suited for CH preparation " + entry.getValue()); ((PrepareContractionHierarchies) entry.getValue()).doWork(); } ghStorage.getProperties().put("prepare.date", formatDateTime(new Date())); } ghStorage.getProperties().put("prepare.done", tmpPrepare); } GraphHopper(); GraphHopper setEncodingManager( EncodingManager em ); EncodingManager getEncodingManager(); GraphHopper setElevationProvider( ElevationProvider eleProvider ); GraphHopper setWayPointMaxDistance( double wayPointMaxDistance ); GraphHopper setTraversalMode( TraversalMode traversalMode ); TraversalMode getTraversalMode(); GraphHopper forServer(); GraphHopper forDesktop(); GraphHopper forMobile(); GraphHopper setPreciseIndexResolution( int precision ); GraphHopper setMinNetworkSize( int minNetworkSize, int minOneWayNetworkSize ); GraphHopper setInMemory(); GraphHopper setStoreOnFlush( boolean storeOnFlush ); GraphHopper setMemoryMapped(); GraphHopper setCHWeighting( String weighting ); String getCHWeighting(); @Deprecated GraphHopper setDoPrepare( boolean doPrepare ); GraphHopper setCHEnable( boolean enable ); void setDefaultWeightLimit( double defaultWeightLimit ); boolean isCHEnabled(); boolean hasElevation(); GraphHopper setElevation( boolean includeElevation ); GraphHopper setEnableInstructions( boolean b ); GraphHopper setEnableCalcPoints( boolean b ); GraphHopper setGraphHopperLocation( String ghLocation ); String getGraphHopperLocation(); GraphHopper setOSMFile( String osmFileStr ); String getOSMFile(); GraphHopperStorage getGraphHopperStorage(); void setGraphHopperStorage( GraphHopperStorage ghStorage ); LocationIndex getLocationIndex(); GraphHopper setSortGraph( boolean sortGraph ); GraphHopper setAllowWrites( boolean allowWrites ); boolean isAllowWrites(); TranslationMap getTranslationMap(); GraphHopper init( CmdArgs args ); GraphHopper importOrLoad(); @Override boolean load( String graphHopperFolder ); RoutingAlgorithmFactory getAlgorithmFactory( Weighting weighting ); Collection<RoutingAlgorithmFactory> getAlgorithmFactories(); GraphHopper putAlgorithmFactory( Weighting weighting, RoutingAlgorithmFactory algoFactory ); Weighting createWeighting( WeightingMap weightingMap, FlagEncoder encoder ); Weighting getWeightingForCH( WeightingMap weightingMap, FlagEncoder encoder ); Weighting createTurnWeighting( Weighting weighting, Graph graph, FlagEncoder encoder ); @Override GHResponse route( GHRequest request ); void close(); void clean();  }### Answer:
@Test public void testPrepare() { instance = new GraphHopper(). setStoreOnFlush(false). setEncodingManager(new EncodingManager("CAR")). setCHWeighting("shortest"). setGraphHopperLocation(ghLoc). setOSMFile(testOsm); instance.importOrLoad(); GHResponse rsp = instance.route(new GHRequest(51.2492152, 9.4317166, 51.2, 9.4). setAlgorithm(AlgorithmOptions.DIJKSTRA_BI)); assertFalse(rsp.hasErrors()); assertEquals(Helper.createPointList(51.249215, 9.431716, 52.0, 9.0, 51.2, 9.4), rsp.getPoints()); assertEquals(3, rsp.getPoints().getSize()); }