src_fm_fc_ms_ff stringlengths 43 86.8k | target stringlengths 20 276k |
|---|---|
Contour { public void calculateContour() { handleBaseCells(); cellStorage.flush(); IntObjectMap<IntHashSet> superCells = handleSuperCells(); cellStorage.storeContourPointerMap(); if (isSupercellsEnabled()) cellStorage.storeSuperCells(superCells); cellStorage.setContourPrepared(true); cellStorage.flush(); } Contour(Grap... | @Test public void testCalculateContour() { GraphHopperStorage graphHopperStorage = ToyGraphCreationUtil.createSimpleGraph(encodingManager); createMockStorages(graphHopperStorage); Contour contour = new Contour(graphHopperStorage, graphHopperStorage.getBaseGraph().getNodeAccess(), ins, cs); contour.calculateContour(); L... |
Contour { public static double distance(double lat1, double lat2, double lon1, double lon2) { final int R = 6371; double latDistance = Math.toRadians(lat2 - lat1); double lonDistance = Math.toRadians(lon2 - lon1); double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2) + Math.cos(Math.toRadians(lat1)) * Math.c... | @Test public void testDistance() { double distance = Contour.distance(1, 1, 1, 2); assertEquals(111177.99068882648, distance, 1e-10); double distance2 = Contour.distance(1, 1, 0.5, -0.5); assertEquals(111177.99068882648, distance2, 1e-10); } |
FastIsochroneAlgorithm extends AbstractIsochroneAlgorithm { public Map<Integer, IntObjectMap<SPTEntry>> getActiveCellMaps() { return activeCellMaps; } FastIsochroneAlgorithm(Graph graph,
Weighting weighting,
TraversalMode tMode,
... | @Test public void testExactWeightActiveCell() { GraphHopperStorage graphHopperStorage = ToyGraphCreationUtil.createMediumGraphWithAdditionalEdge(encodingManager); Weighting shortestWeighting = new ShortestWeighting(carEncoder); createMockStorages(graphHopperStorage); Eccentricity ecc = new Eccentricity(graphHopperStora... |
FastIsochroneAlgorithm extends AbstractIsochroneAlgorithm { public IntObjectMap<SPTEntry> getStartCellMap() { return startCellMap; } FastIsochroneAlgorithm(Graph graph,
Weighting weighting,
TraversalMode tMode,
CellSto... | @Test public void testStartCell() { GraphHopperStorage graphHopperStorage = ToyGraphCreationUtil.createMediumGraphWithAdditionalEdge(encodingManager); Weighting shortestWeighting = new ShortestWeighting(carEncoder); createMockStorages(graphHopperStorage); Eccentricity ecc = new Eccentricity(graphHopperStorage, null, in... |
FastIsochroneAlgorithm extends AbstractIsochroneAlgorithm { public Set<Integer> getFullyReachableCells() { return fullyReachableCells; } FastIsochroneAlgorithm(Graph graph,
Weighting weighting,
TraversalMode tMode,
Cel... | @Test public void testFullyReachableCells() { GraphHopperStorage graphHopperStorage = ToyGraphCreationUtil.createMediumGraphWithAdditionalEdge(encodingManager); Weighting shortestWeighting = new ShortestWeighting(carEncoder); createMockStorages(graphHopperStorage); Eccentricity ecc = new Eccentricity(graphHopperStorage... |
ActiveCellDijkstra extends AbstractIsochroneDijkstra { protected void addInitialBordernode(int nodeId, double weight) { SPTEntry entry = new SPTEntry(nodeId, weight); fromHeap.add(entry); fromMap.put(nodeId, entry); } ActiveCellDijkstra(Graph graph, Weighting weighting, IsochroneNodeStorage isochroneNodeStorage, int ce... | @Test public void testAddInitialBorderNode() { GraphHopperStorage graphHopperStorage = ToyGraphCreationUtil.createMediumGraph(encodingManager); createMockStorages(graphHopperStorage); Weighting shortestWeighting = new ShortestWeighting(carEncoder); ActiveCellDijkstra activeCellDijkstra = new ActiveCellDijkstra(graphHop... |
RangeDijkstra extends AbstractIsochroneDijkstra { private void getMaxWeight() { for (IntObjectCursor<SPTEntry> entry : fromMap) { if (USERELEVANTONLY && !relevantNodes.contains(entry.key)) continue; if (maximumWeight < entry.value.weight) maximumWeight = entry.value.weight; } } RangeDijkstra(Graph graph, Weighting weig... | @Test public void testGetMaxWeight() { GraphHopperStorage graphHopperStorage = createSimpleGraph(); RangeDijkstra rangeDijkstra = new RangeDijkstra(graphHopperStorage.getBaseGraph(), new ShortestWeighting(carEncoder)); rangeDijkstra.setMaxVisitedNodes(getMaxCellNodesNumber() * 10); IntHashSet cellNodes = new IntHashSet... |
PartitioningDataBuilder { PartitioningDataBuilder(Graph graph, PartitioningData pData) { this.graph = graph; this.pData = pData; } PartitioningDataBuilder(Graph graph, PartitioningData pData); void run(); } | @Test public void testPartitioningDataBuilder() { GraphHopperStorage ghStorage = ToyGraphCreationUtil.createMediumGraph(encodingManager); PartitioningData pData = new PartitioningData(); EdgeFilter edgeFilter = new EdgeFilterSequence(); PartitioningDataBuilder partitioningDataBuilder = new PartitioningDataBuilder(ghSto... |
OSMAttachedSidewalkProcessor { public ReaderWay attachSidewalkTag(ReaderWay way, Side side) { switch(side) { case LEFT: way.setTag(KEY_ORS_SIDEWALK_SIDE, VAL_LEFT); break; case RIGHT: way.setTag(KEY_ORS_SIDEWALK_SIDE, VAL_RIGHT); break; case BOTH: if(way.hasTag(KEY_ORS_SIDEWALK_SIDE) && way.getTag(KEY_ORS_SIDEWALK_SIDE... | @Test public void TestAttachingORSSidewalkSideTagForWayWithSingleSide() { ReaderWay way = new ReaderWay(1); way = processor.attachSidewalkTag(way, OSMAttachedSidewalkProcessor.Side.LEFT); assertTrue(way.hasTag("ors-sidewalk-side")); String side = way.getTag("ors-sidewalk-side"); assertEquals("left", side); way = new Re... |
Projector { protected Map<Projection, IntArrayList> calculateProjections() { EnumMap<Projection, IntArrayList> nodeListProjMap = new EnumMap<>(Projection.class); Integer[] ids = IntStream.rangeClosed(0, ghStorage.getNodes() - 1).boxed().toArray(Integer[]::new); Double[] values = new Double[ids.length]; Sort sort = new ... | @Test public void testCalculateProjections() { Projector projector = new Projector(); projector.setGHStorage(ToyGraphCreationUtil.createMediumGraph2(encodingManager)); Map<Projector.Projection, IntArrayList> projections = projector.calculateProjections(); IntArrayList expected_m00 = new IntArrayList(); expected_m00.add... |
Projector { protected List<Projection> calculateProjectionOrder(Map<Projection, IntArrayList> projections) { List<Projection> order; EnumMap<Projection, Double> squareRangeProjMap = new EnumMap<>(Projection.class); EnumMap<Projection, Double> orthogonalDiffProjMap = new EnumMap<>(Projection.class); for (Map.Entry<Proje... | @Test public void testCalculateProjectionOrder() { double originalSplitValue = getSplitValue(); setSplitValue(0); Projector projector = new Projector(); projector.setGHStorage(ToyGraphCreationUtil.createMediumGraph2(encodingManager)); Map<Projector.Projection, IntArrayList> projections = projector.calculateProjections(... |
MaxFlowMinCut { protected void reset() { resetAlgorithm(); resetData(); } MaxFlowMinCut(Graph graph, PartitioningData pData, EdgeFilter edgeFilter); void setVisited(int node); boolean isVisited(int visited); void setUnvisitedAll(); abstract int getMaxFlow(); BiPartition calcNodePartition(); void setNodeOrder(); void se... | @Test public void testReset() { GraphHopperStorage graphHopperStorage = ToyGraphCreationUtil.createMediumGraph(encodingManager); Graph graph = graphHopperStorage.getBaseGraph(); int[] flowEdgeBaseNode = new int[]{ 0, 1, 0, 2, 0, 3, 0, 8, 1, 2, 1, 8, 2, 3, 3, 4, 4, 5, 4, 6, 5, 7, 6, 7, 7, 8, -1, -1 }; boolean[] flow = n... |
FastIsochroneFactory { public void init(CmdArgs args) { setMaxThreadCount(args.getInt(FastIsochrone.PREPARE + "threads", getMaxThreadCount())); setMaxCellNodesNumber(args.getInt(FastIsochrone.PREPARE + "maxcellnodes", getMaxCellNodesNumber())); String weightingsStr = args.get(FastIsochrone.PREPARE + "weightings", ""); ... | @Test public void testInit() { FastIsochroneFactory fastIsochroneFactory = intitFastIsochroneFactory(); assertTrue(fastIsochroneFactory.isEnabled()); assertTrue(fastIsochroneFactory.isDisablingAllowed()); assertEquals("fastest", fastIsochroneFactory.getFastisochroneProfileStrings().iterator().next()); } |
FastIsochroneFactory { public void prepare(final StorableProperties properties) { ExecutorService threadPool = Executors.newFixedThreadPool(1); ExecutorCompletionService<String> completionService = new ExecutorCompletionService<>(threadPool); final String name = "PreparePartition"; completionService.submit(() -> { Thre... | @Test public void testPrepare() { GraphHopperStorage gs = ToyGraphCreationUtil.createMediumGraph(encodingManager); FastIsochroneFactory fastIsochroneFactory = intitFastIsochroneFactory(); fastIsochroneFactory.createPreparation(gs, null); fastIsochroneFactory.prepare(gs.getProperties()); assertNotNull(fastIsochroneFacto... |
XMLBuilder { public String build(Gpx gpx) throws JAXBException { JAXBContext context = JAXBContext.newInstance(Gpx.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); StringWriter sw = new StringWriter(); m.marshal(gpx, sw); return sw.toString(); } String b... | @Test public void testBuild() throws JAXBException { XMLBuilder xMLBuilder = new XMLBuilder(); String result = xMLBuilder.build(gpx); Assert.assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<gpx version=\"1.0\" xmlns=\"https: " <metadata>\n" + " <name></name>\n" + " <desc></desc>\n" + "... |
GeoJsonResponseWriter { public static JSONObject addProperties(SimpleFeature simpleFeature, Map<String, Map<String, Object>> featurePropertiesMap) throws IOException { StringWriter stringWriter = new StringWriter(); fjson.writeFeature(simpleFeature, stringWriter); JSONObject featureAsJSON = new JSONObject(stringWriter.... | @Test public void testAddProperties() throws Exception { JSONObject expectedJSON = new JSONObject("{\"geometry\":{\"coordinates\":[[1,1],[1,1],[1,1]],\"type\":\"LineString\"},\"id\":\"" + routingFeatureID + "\",\"type\":\"Feature\",\"properties\":{\"bbox\":[1,1,1,1],\"way_points\":[1,1],\"segments\":[1]}}"); JSONObject... |
CountryBordersPolygon { public String getName() { return this.name; } CountryBordersPolygon(String name, Geometry boundary); double[] getBBox(); boolean shares(MultiPolygon other); boolean crossesBoundary(LineString line); String getName(); MultiPolygon getBoundary(); boolean inBbox(Coordinate c); boolean inArea(Coordi... | @Test public void TestName() { assertEquals("name", cbp.getName()); } |
CountryBordersPolygon { public MultiPolygon getBoundary() { return this.boundary; } CountryBordersPolygon(String name, Geometry boundary); double[] getBBox(); boolean shares(MultiPolygon other); boolean crossesBoundary(LineString line); String getName(); MultiPolygon getBoundary(); boolean inBbox(Coordinate c); boolean... | @Test public void TestBoundaryGeometry() { MultiPolygon boundary = cbp.getBoundary(); Coordinate[] cbpCoords = boundary.getCoordinates(); assertEquals(country1Geom.length, cbpCoords.length); assertEquals(country1Geom[0].x, cbpCoords[0].x, 0.0); assertEquals(country1Geom[3].y, cbpCoords[3].y,0.0); } |
CountryBordersPolygon { public double[] getBBox() { return new double[] {minLon, maxLon, minLat, maxLat}; } CountryBordersPolygon(String name, Geometry boundary); double[] getBBox(); boolean shares(MultiPolygon other); boolean crossesBoundary(LineString line); String getName(); MultiPolygon getBoundary(); boolean inBbo... | @Test public void TestBBox() { double[] bbox = cbp.getBBox(); assertEquals(-1.0, bbox[0], 0.0); assertEquals(1.0, bbox[1], 0.0); assertEquals(-1.0, bbox[2], 0.0); assertEquals(2.0, bbox[3], 0.0); } |
CountryBordersPolygon { public boolean crossesBoundary(LineString line) { return this.boundaryLine.intersects(line); } CountryBordersPolygon(String name, Geometry boundary); double[] getBBox(); boolean shares(MultiPolygon other); boolean crossesBoundary(LineString line); String getName(); MultiPolygon getBoundary(); bo... | @Test public void TestIntersection() { LineString ls = gf.createLineString(new Coordinate[] { new Coordinate(0.5, 0.5), new Coordinate(-10.5, -10.5) }); assertTrue(cbp.crossesBoundary(ls)); ls = gf.createLineString(new Coordinate[] { new Coordinate(0.5, 0.5), new Coordinate(0.25, 0.25) }); assertFalse(cbp.crossesBounda... |
CountryBordersPolygon { public boolean inBbox(Coordinate c) { return !(c.x < minLon || c.x > maxLon || c.y < minLat || c.y > maxLat); } CountryBordersPolygon(String name, Geometry boundary); double[] getBBox(); boolean shares(MultiPolygon other); boolean crossesBoundary(LineString line); String getName(); MultiPolygon ... | @Test public void TestBBoxContains() { assertTrue(cbp.inBbox(new Coordinate(0.5, 0.5))); assertFalse(cbp.inBbox(new Coordinate(10.0, 0.5))); } |
BordersExtractor { public boolean isOpenBorder(int edgeId) { return storage.getEdgeValue(edgeId, BordersGraphStorage.Property.TYPE) == BordersGraphStorage.OPEN_BORDER; } BordersExtractor(BordersGraphStorage storage, int[] avoidCountries); int getValue(int edgeId); boolean isBorder(int edgeId); boolean isControlledBorde... | @Test public void TestDetectOpenBorder() { VirtualEdgeIteratorState ve1 = generateEdge(1); VirtualEdgeIteratorState ve2 = generateEdge(2); VirtualEdgeIteratorState ve3 = generateEdge(3); BordersExtractor be = new BordersExtractor(_graphstorage, new int[0]); assertEquals(false, be.isOpenBorder(1)); assertEquals(true, be... |
CountryBordersPolygon { public boolean inArea(Coordinate c) { if(!Double.isNaN(c.x) && !Double.isNaN(c.y) && inBbox(c)) { GeometryFactory gf = new GeometryFactory(); return boundary.contains(gf.createPoint(c)); } return false; } CountryBordersPolygon(String name, Geometry boundary); double[] getBBox(); boolean shares(M... | @Test public void TestPolygonContains() { assertTrue(cbp.inArea(new Coordinate(0.5, 0.5))); assertFalse(cbp.inArea(new Coordinate(-0.5, -0.5))); } |
CountryBordersReader { public CountryBordersPolygon[] getCountry(Coordinate c) { ArrayList<CountryBordersPolygon> countries = new ArrayList<>(); Iterator it = hierarchies.entrySet().iterator(); while(it.hasNext()) { Map.Entry<Long, CountryBordersHierarchy> pair = (Map.Entry)it.next(); CountryBordersHierarchy h = pair.g... | @Test public void TestGetCountry() { Coordinate c = new Coordinate(0.5, 0.5); CountryBordersPolygon[] polys = _reader.getCountry(c); assertEquals(1, polys.length); assertEquals("country1", polys[0].getName()); } |
CountryBordersReader { public CountryBordersPolygon[] getCandidateCountry(Coordinate c) { ArrayList<CountryBordersPolygon> countries = new ArrayList<>(); Iterator it = hierarchies.entrySet().iterator(); while(it.hasNext()) { Map.Entry<Long, CountryBordersHierarchy> pair = (Map.Entry)it.next(); CountryBordersHierarchy h... | @Test public void TestGetCandidateCountry() { Coordinate c = new Coordinate(-0.25, -0.25); CountryBordersPolygon[] polys = _reader.getCandidateCountry(c); assertEquals(1, polys.length); assertEquals("country3", polys[0].getName()); } |
CountryBordersReader { public String getId(String name) { if(name.equals(INTERNATIONAL_NAME)) return INTERNATIONAL_ID; if(ids.containsKey(name)) return ids.get(name).id; else return ""; } CountryBordersReader(); CountryBordersReader(String filepath, String idsPath, String openPath); void addHierarchy(Long id, CountryB... | @Test public void TestGetCountryId() { assertEquals("1", _reader.getId("country1")); } |
CountryBordersReader { public String getEngName(String name) { if(name.equals(INTERNATIONAL_NAME)) return INTERNATIONAL_NAME; if(ids.containsKey(name)) return ids.get(name).nameEng; else return ""; } CountryBordersReader(); CountryBordersReader(String filepath, String idsPath, String openPath); void addHierarchy(Long ... | @Test public void TestGetCountryEnglishName() { assertEquals("country1 English", _reader.getEngName("country1")); } |
CountryBordersReader { public boolean isOpen(String c1, String c2) { if(openBorders.containsKey(c1)) { return openBorders.get(c1).contains(c2); } else if(openBorders.containsKey(c2)) return openBorders.get(c2).contains(c1); return false; } CountryBordersReader(); CountryBordersReader(String filepath, String idsPath, S... | @Test public void TestGetOpenBorder() { assertTrue(_reader.isOpen("country1", "country2")); assertFalse(_reader.isOpen("country1", "country3")); } |
CountryBordersReader { public static int getCountryIdByISOCode(String code) { return currentInstance != null ? currentInstance.isoCodes.getOrDefault(code.toUpperCase(), 0) : 0; } CountryBordersReader(); CountryBordersReader(String filepath, String idsPath, String openPath); void addHierarchy(Long id, CountryBordersHie... | @Test public void TestGetCountryIdByISOCode() { assertEquals(1, CountryBordersReader.getCountryIdByISOCode("CT")); assertEquals(1, CountryBordersReader.getCountryIdByISOCode("CTR")); assertEquals(0, CountryBordersReader.getCountryIdByISOCode("FOO")); } |
CountryBordersHierarchy { public double[] getBBox() { return new double[] {minLon, maxLon, minLat, maxLat}; } void add(CountryBordersPolygon cp); boolean inBbox(Coordinate c); double[] getBBox(); List<CountryBordersPolygon> getPolygons(); List<CountryBordersPolygon> getContainingPolygons(Coordinate c); } | @Test public void GetBBoxTest() { double[] bbox = cbh1.getBBox(); assertEquals(-1.0, bbox[0], 0.0); assertEquals(1.0, bbox[1], 0.0); assertEquals(-1.0, bbox[2], 0.0); assertEquals(1.0, bbox[3], 0.0); bbox = cbh2.getBBox(); assertEquals(5.0, bbox[0], 0.0); assertEquals(10.0, bbox[1], 0.0); assertEquals(5.0, bbox[2], 0.0... |
CountryBordersHierarchy { public boolean inBbox(Coordinate c) { return !(c.x <= minLon || c.x >= maxLon || c.y <= minLat || c.y >= maxLat); } void add(CountryBordersPolygon cp); boolean inBbox(Coordinate c); double[] getBBox(); List<CountryBordersPolygon> getPolygons(); List<CountryBordersPolygon> getContainingPolygon... | @Test public void InBBoxTest() { assertTrue(cbh1.inBbox(new Coordinate(0.5, 0.5))); assertTrue(cbh1.inBbox(new Coordinate(-0.5, 0.5))); assertFalse(cbh1.inBbox(new Coordinate(7.5, 7.5))); assertFalse(cbh1.inBbox(new Coordinate(100, 100))); } |
CountryBordersHierarchy { public List<CountryBordersPolygon> getContainingPolygons(Coordinate c) { ArrayList<CountryBordersPolygon> containing = new ArrayList<>(); if(!Double.isNaN(c.x) && !Double.isNaN(c.y) && inBbox(c)) { for (CountryBordersPolygon cbp : polygons) { if (cbp.inBbox(c)) { containing.add(cbp); } } } ret... | @Test public void GetCountryTest() { List<CountryBordersPolygon> containing = cbh1.getContainingPolygons(new Coordinate(0.9, 0.9)); assertEquals(1, containing.size()); assertEquals("name1", containing.get(0).getName()); containing = cbh1.getContainingPolygons(new Coordinate(0.0, 0.0)); assertEquals(2, containing.size()... |
BordersExtractor { public boolean restrictedCountry(int edgeId) { int startCountry = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.START); int endCountry = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.END); for(int i = 0; i< avoidCountries.length; i++) { if(startCountry == avoidCountries[i] || ... | @Test public void TestAvoidCountry() { VirtualEdgeIteratorState ve1 = generateEdge(1); VirtualEdgeIteratorState ve2 = generateEdge(2); VirtualEdgeIteratorState ve3 = generateEdge(3); BordersExtractor be = new BordersExtractor(_graphstorage, new int[] {2, 4}); assertEquals(true, be.restrictedCountry(1)); assertEquals(tr... |
RouteResultBuilder { RouteResult createMergedRouteResultFromBestPaths(List<GHResponse> responses, RoutingRequest request, List<RouteExtraInfo>[] extras) throws Exception { RouteResult result = createInitialRouteResult(request, extras[0]); for (int ri = 0; ri < responses.size(); ++ri) { GHResponse response = responses.g... | @Test public void TestCreateMergedRouteResultFromBestPaths() throws Exception { List<GHResponse> responseList = new ArrayList<>(); RoutingRequest routingRequest = new RouteRequestHandler().convertRouteRequest(request1); List<RouteExtraInfo> extrasList = new ArrayList<>(); RouteResultBuilder builder = new RouteResultBui... |
RouteSearchParameters { public int getProfileType() { return profileType; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatu... | @Test public void getProfileType() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertEquals(0, routeSearchParameters.getProfileType()); } |
RouteSearchParameters { public void setProfileType(int profileType) throws Exception { if (profileType == RoutingProfileType.UNKNOWN) throw new Exception("Routing profile is unknown."); this.profileType = profileType; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeigh... | @Test public void setProfileType() throws Exception { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setProfileType(2); Assert.assertEquals(2, routeSearchParameters.getProfileType()); } |
RouteSearchParameters { public int getWeightingMethod() { return weightingMethod; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAv... | @Test public void getWeightingMethod() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertEquals(WeightingMethod.FASTEST, routeSearchParameters.getWeightingMethod(), 0.0); } |
RouteSearchParameters { public void setWeightingMethod(int weightingMethod) { this.weightingMethod = weightingMethod; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas)... | @Test public void setWeightingMethod() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setWeightingMethod(WeightingMethod.RECOMMENDED); Assert.assertEquals(WeightingMethod.RECOMMENDED, routeSearchParameters.getWeightingMethod(), 0.0); } |
RouteSearchParameters { public Polygon[] getAvoidAreas() { return avoidAreas; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidF... | @Test public void getAvoidAreas() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertArrayEquals(null, routeSearchParameters.getAvoidAreas()); } |
RouteSearchParameters { public void setAvoidAreas(Polygon[] avoidAreas) { this.avoidAreas = avoidAreas; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasA... | @Test public void setAvoidAreas() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidAreas(new Polygon[0]); Assert.assertArrayEquals(new Polygon[0], routeSearchParameters.getAvoidAreas()); } |
RouteSearchParameters { public boolean hasAvoidAreas() { return avoidAreas != null && avoidAreas.length > 0; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean... | @Test public void hasAvoidAreas() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.hasAvoidAreas()); routeSearchParameters.setAvoidAreas(new Polygon[1]); Assert.assertTrue(routeSearchParameters.hasAvoidAreas()); } |
RouteSearchParameters { public int getAvoidFeatureTypes() { return avoidFeaturesTypes; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int ... | @Test public void getAvoidFeatureTypes() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertEquals(0, routeSearchParameters.getAvoidFeatureTypes()); } |
RouteSearchParameters { public void setAvoidFeatureTypes(int avoidFeatures) { avoidFeaturesTypes = avoidFeatures; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); bo... | @Test public void setAvoidFeatureTypes() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidFeatureTypes(1); Assert.assertEquals(1, routeSearchParameters.getAvoidFeatureTypes()); } |
BordersExtractor { public boolean isSameCountry(List<Integer> edgeIds){ if(edgeIds.isEmpty()) return true; short country0 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.START); short country1 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.END); for(int edgeId : edgeIds) { short... | @Test public void TestIsSameCountry() { VirtualEdgeIteratorState ve1 = generateEdge(1); VirtualEdgeIteratorState ve2 = generateEdge(2); VirtualEdgeIteratorState ve3 = generateEdge(3); BordersExtractor be = new BordersExtractor(_graphstorage, new int[] {2, 4}); List<Integer> countries = new ArrayList<>(); countries.add(... |
RouteSearchParameters { public boolean hasAvoidFeatures() { return avoidFeaturesTypes > 0; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); ... | @Test public void hasAvoidFeatures() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.hasAvoidFeatures()); routeSearchParameters.setAvoidFeatureTypes(1); Assert.assertTrue(routeSearchParameters.hasAvoidFeatures()); } |
RouteSearchParameters { public int[] getAvoidCountries() { return avoidCountries; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAv... | @Test public void getAvoidCountries() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertNull(routeSearchParameters.getAvoidCountries()); } |
RouteSearchParameters { public void setAvoidCountries(int[] avoidCountries) { this.avoidCountries = avoidCountries; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); ... | @Test public void setAvoidCountries() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidCountries(new int[1]); Assert.assertArrayEquals(new int[1], routeSearchParameters.getAvoidCountries()); } |
RouteSearchParameters { public boolean hasAvoidCountries() { return avoidCountries != null && avoidCountries.length > 0; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAre... | @Test public void hasAvoidCountries() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.hasAvoidCountries()); routeSearchParameters.setAvoidCountries(new int[1]); Assert.assertTrue(routeSearchParameters.hasAvoidCountries()); } |
RouteSearchParameters { public boolean hasAvoidBorders() { return avoidBorders != BordersExtractor.Avoid.NONE; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boole... | @Test public void hasAvoidBorders() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.hasAvoidBorders()); routeSearchParameters.setAvoidBorders(BordersExtractor.Avoid.CONTROLLED); Assert.assertTrue(routeSearchParameters.hasAvoidBorders()); } |
RouteSearchParameters { public void setAvoidBorders(BordersExtractor.Avoid avoidBorders) { this.avoidBorders = avoidBorders; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoi... | @Test public void setAvoidBorders() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidBorders(BordersExtractor.Avoid.CONTROLLED); Assert.assertEquals(BordersExtractor.Avoid.CONTROLLED, routeSearchParameters.getAvoidBorders()); } |
RouteSearchParameters { public BordersExtractor.Avoid getAvoidBorders() { return avoidBorders; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas... | @Test public void getAvoidBorders() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertEquals(BordersExtractor.Avoid.NONE, routeSearchParameters.getAvoidBorders()); } |
RouteSearchParameters { public Boolean getConsiderTurnRestrictions() { return considerTurnRestrictions; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasA... | @Test public void getConsiderTurnRestrictions() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.getConsiderTurnRestrictions()); } |
RouteSearchParameters { public void setConsiderTurnRestrictions(Boolean considerTurnRestrictions) { this.considerTurnRestrictions = considerTurnRestrictions; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); ... | @Test public void setConsiderTurnRestrictions() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setConsiderTurnRestrictions(true); Assert.assertTrue(routeSearchParameters.getConsiderTurnRestrictions()); } |
RouteSearchParameters { public int getVehicleType() { return vehicleType; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatu... | @Test public void getVehicleType() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertEquals(HeavyVehicleAttributes.UNKNOWN, routeSearchParameters.getVehicleType()); } |
EncodeUtils { public static byte[] longToByteArray(long longValue) { ByteBuffer longToByteBuffer = ByteBuffer.allocate(Long.BYTES); longToByteBuffer.putLong(longValue); return longToByteBuffer.array(); } private EncodeUtils(); static byte[] longToByteArray(long longValue); static long byteArrayToLong(byte[] byteArray)... | @Test public void longToByteArrayTest() { long value = 1234L; byte[] byteValue = EncodeUtils.longToByteArray(value); assertEquals(8, byteValue.length); assertEquals(-46, byteValue[7]); assertEquals(4, byteValue[6]); } |
RouteSearchParameters { public void setVehicleType(int vehicleType) { this.vehicleType = vehicleType; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvo... | @Test public void setVehicleType() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setVehicleType(HeavyVehicleAttributes.AGRICULTURE); Assert.assertEquals(HeavyVehicleAttributes.AGRICULTURE, routeSearchParameters.getVehicleType()); } |
RouteSearchParameters { public String getOptions() { return options; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTyp... | @Test public void getOptions() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertNull(routeSearchParameters.getOptions()); } |
RouteSearchParameters { public boolean hasParameters(Class<?> value) { if (profileParams == null) return false; return profileParams.getClass() == value; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void... | @Test public void hasParameters() throws Exception { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.hasParameters(routeSearchParameters.getClass())); routeSearchParameters.setProfileType(2); routeSearchParameters.setOptions("{\"profile_params\":{\"wei... |
RouteSearchParameters { public ProfileParameters getProfileParameters() { return profileParams; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidArea... | @Test public void getProfileParameters() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertNull(routeSearchParameters.getProfileParameters()); } |
RouteSearchParameters { public boolean getFlexibleMode() { return flexibleMode; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoi... | @Test public void getFlexibleMode() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.getFlexibleMode()); } |
RouteSearchParameters { public void setFlexibleMode(boolean flexibleMode) { this.flexibleMode = flexibleMode; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolea... | @Test public void setFlexibleMode() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setFlexibleMode(true); Assert.assertTrue(routeSearchParameters.getFlexibleMode()); } |
RouteSearchParameters { public double[] getMaximumRadiuses() { return maxRadiuses; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getA... | @Test public void getMaximumRadiuses() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertNull(routeSearchParameters.getMaximumRadiuses()); } |
RouteSearchParameters { public void setMaximumRadiuses(double[] maxRadiuses) { this.maxRadiuses = maxRadiuses; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boole... | @Test public void setMaximumRadiuses() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setMaximumRadiuses(new double[0]); Assert.assertNotNull(routeSearchParameters.getMaximumRadiuses()); Assert.assertSame(routeSearchParameters.getMaximumRadiuses().getClass(), double[]... |
RouteSearchParameters { public WayPointBearing[] getBearings() { return bearings; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAv... | @Test public void getBearings() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertNull(routeSearchParameters.getBearings()); } |
RouteSearchParameters { public void setBearings(WayPointBearing[] bearings) { this.bearings = bearings; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasA... | @Test public void setBearings() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setBearings(new WayPointBearing[]{}); Assert.assertArrayEquals(new WayPointBearing[]{}, routeSearchParameters.getBearings()); } |
EncodeUtils { public static long byteArrayToLong(byte[] byteArray) { ByteBuffer byteToLongBuffer = ByteBuffer.allocate(Long.BYTES); byte[] storageBytes = {0,0,0,0,0,0,0,0}; int differenceInSize = storageBytes.length - byteArray.length; for(int i = byteArray.length-1; i >= 0; i--) { if(differenceInSize + i >= 0) storage... | @Test public void byteArrayToLongTest() { byte[] byteArr = {0,0,0,0,73,-106,2,-46}; long value = EncodeUtils.byteArrayToLong(byteArr); assertEquals(1234567890, value); byte[] byteArr2 = {-24,106,4,-97}; long value2 = EncodeUtils.byteArrayToLong(byteArr2); assertEquals(3899262111L, value2); byte[] byteArr3 = {124,0,0,12... |
RouteSearchParameters { public boolean requiresDynamicPreprocessedWeights() { return hasAvoidAreas() || hasAvoidFeatures() || hasAvoidBorders() || hasAvoidCountries() || getConsiderTurnRestrictions() || isProfileTypeHeavyVehicle() && getVehicleType() > 0 || isProfileTypeDriving() && hasParameters(VehicleParameters.clas... | @Test public void requiresDynamicPreprocessedWeights() throws Exception { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.requiresDynamicPreprocessedWeights()); routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidAreas(ne... |
GeomUtility { public static BBox calculateBoundingBox(PointList pointList) { if (pointList == null || pointList.getSize() <= 0) { return new BBox(0, 0, 0, 0); } else { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle ... | @Test public void calculateBoundingBox() { BBox bbox3D = GeomUtility.calculateBoundingBox(pointList3D); BBox bbox2D = GeomUtility.calculateBoundingBox(pointList2D); BBox bbox_fallback = GeomUtility.calculateBoundingBox(emptyPointList); Assert.assertEquals(-35.507813,bbox3D.minLon, 0.000009); Assert.assertEquals(38.4082... |
GeomUtility { public static BBox generateBoundingFromMultiple(BBox[] boundingBoxes) { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for(BBox bbox : boundingBox... | @Test public void generateBBoxFromMultiple() { BBox[] bboxes = { new BBox(1.5, 2.5, -1.5, 1.5, 10, 20), new BBox(2.6, 8.5, -0.5, 1.7, 5, 25) }; BBox bbox = GeomUtility.generateBoundingFromMultiple(bboxes); Assert.assertEquals(-1.5, bbox.minLat, 0); Assert.assertEquals(1.7, bbox.maxLat, 0); Assert.assertEquals(1.5, bbox... |
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX(... | @Test public void constructNegativeIsochroneBBoxTest() { BBox bbox = JsonIsochronesRequestProcessor.constructIsochroneBBox(negativeEnv); BBox expectedBBox = new BBox(-77.033874, -77.025082, -12.127332, -12.120505); Assert.assertTrue(bbox.isValid()); Assert.assertEquals(expectedBBox.maxLat, bbox.maxLat, 0.0); Assert.ass... |
SystemMessage { public static String getSystemMessage(Object requestObj) { if (messages == null) { loadMessages(); } if (messages.isEmpty()) { return ""; } if (requestObj == null) { requestObj = ""; } RequestParams params = new RequestParams(); if (requestObj.getClass() == RoutingRequest.class) { extractParams((Routing... | @Test public void testGetSystemMessage() throws ParameterValueException { System.setProperty("ors_app_config", "target/test-classes/app.config.test"); RoutingRequest v1RouteRequest = new RoutingRequest(); Assert.assertEquals("This message would be sent with every request on API v1 from January 2020 until June 2050", Sy... |
MatrixResponse { public MatrixResponseInfo getResponseInformation() { return responseInformation; } MatrixResponse(MatrixResult result, MatrixRequest request); MatrixResponseInfo getResponseInformation(); MatrixResult getMatrixResult(); MatrixRequest getMatrixRequest(); } | @Test public void getResponseInformation() { Assert.assertEquals(MatrixResponseInfo.class, bareMatrixResponse.responseInformation.getClass()); Assert.assertNotNull(bareMatrixResponse.responseInformation); } |
JSONBasedIndividualMatrixResponse { List<JSON2DDestinations> constructDestinations(MatrixResult matrixResult) { List<JSON2DDestinations> destinations = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getDestinations()) { if (location != null) destinations.add(new JSON2DDestinations(location, includeRes... | @Test public void constructDestinations() { List<JSON2DDestinations> json2DDestinations = jsonBasedIndividualMatrixResponse.constructDestinations(matrixResult); Assert.assertEquals(1, json2DDestinations.size()); Assert.assertEquals("foo", json2DDestinations.get(0).name); Assert.assertEquals(new Coordinate(8.681495, 49.... |
JSONBasedIndividualMatrixResponse { List<JSON2DSources> constructSources(MatrixResult matrixResult) { List<JSON2DSources> sources = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getSources()) { if (location != null) sources.add(new JSON2DSources(location, includeResolveLocations)); else sources.add(n... | @Test public void constructSources() { List<JSON2DSources> json2DSources = jsonBasedIndividualMatrixResponse.constructSources(matrixResult); Assert.assertEquals(1, json2DSources.size()); Assert.assertEquals("foo", json2DSources.get(0).name); Assert.assertEquals(new Coordinate(8.681495, 49.41461, Double.NaN), json2DSour... |
JSONMatrixResponse extends MatrixResponse { @JsonProperty("matrix") @JsonUnwrapped public JSONIndividualMatrixResponse getMatrix() { return new JSONIndividualMatrixResponse(matrixResult, matrixRequest); } JSONMatrixResponse(MatrixResult result, MatrixRequest request); @JsonProperty("matrix") @JsonUnwrapped JSONIndividu... | @Test public void getMatrix() { JSONIndividualMatrixResponse durationMatrix = jsonMatrixDurationsResponse.getMatrix(); Assert.assertNotNull(durationMatrix.getDurations()); Assert.assertNull(durationMatrix.getDistances()); Assert.assertEquals(3, durationMatrix.getDestinations().size()); Assert.assertEquals(3, durationMa... |
JSONMatrixResponse extends MatrixResponse { @JsonProperty("metadata") @ApiModelProperty("Information about the service and request") public MatrixResponseInfo getInfo() { return responseInformation; } JSONMatrixResponse(MatrixResult result, MatrixRequest request); @JsonProperty("matrix") @JsonUnwrapped JSONIndividualMa... | @Test public void getInfo() { Assert.assertEquals(MatrixResponseInfo.class, jsonMatrixDurationsResponse.getInfo().getClass()); Assert.assertNotNull(jsonMatrixDurationsResponse.getInfo().getEngineInfo()); Assert.assertNotNull(jsonMatrixDurationsResponse.getInfo().getAttribution()); Assert.assertNotNull(jsonMatrixDuratio... |
JSONLocation { public Double getSnappedDistance() { return FormatUtility.roundToDecimals(snappedDistance, SNAPPED_DISTANCE_DECIMAL_PLACES); } JSONLocation(ResolvedLocation location, boolean includeResolveLocations); Double getSnappedDistance(); Double[] getLocation(); } | @Test public void getSnapped_distance() { Assert.assertEquals("foo", jsonLocationWithLocation.name); Assert.assertEquals(new Double(0.0), jsonLocationWithLocation.getSnappedDistance()); } |
JSONLocation { public Double[] getLocation() { return new Double[0]; } JSONLocation(ResolvedLocation location, boolean includeResolveLocations); Double getSnappedDistance(); Double[] getLocation(); } | @Test public void getLocation() { Assert.assertEquals(new Coordinate(8.681495, 49.41461, Double.NaN), jsonLocationWithLocation.location); Assert.assertArrayEquals(new Double[0], jsonLocationWithLocation.getLocation()); } |
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public Double[][] getDistances() { return distances; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] ge... | @Test public void getDistances() { Assert.assertNull(durationsMatrixResponse.getDistances()); Assert.assertArrayEquals(new Double[]{0.0, 1.0, 2.0}, distancesMatrixResponse.getDistances()[0]); Assert.assertArrayEquals(new Double[]{3.0,4.0,5.0}, combinedMatrixResponse.getDistances()[1]); } |
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDistances(Double[][] distances) { this.distances = distances; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> get... | @Test public void setDistances() { distancesMatrixResponse.setDistances(new Double[][]{{1.0, 2.0, 3.0},{1.0, 2.0, 3.0},{1.0, 2.0, 3.0}}); Assert.assertEquals(3, distancesMatrixResponse.getDistances().length); Assert.assertArrayEquals(new Double[]{1.0, 2.0, 3.0}, distancesMatrixResponse.getDistances()[0]); Assert.assert... |
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public Double[][] getDurations() { return durations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] ge... | @Test public void getDurations() { Assert.assertEquals(3, durationsMatrixResponse.getDurations().length); Assert.assertArrayEquals(new Double[]{0.0, 1.0, 2.0}, durationsMatrixResponse.getDurations()[0]); Assert.assertNull(distancesMatrixResponse.getDurations()); Assert.assertArrayEquals(new Double[]{3.0,4.0,5.0}, combi... |
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDurations(Double[][] durations) { this.durations = durations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> get... | @Test public void setDurations() { durationsMatrixResponse.setDurations(new Double[][]{{1.0, 2.0, 3.0},{1.0, 2.0, 3.0},{1.0, 2.0, 3.0}}); Assert.assertEquals(3, durationsMatrixResponse.getDurations().length); Assert.assertArrayEquals(new Double[]{1.0, 2.0, 3.0}, durationsMatrixResponse.getDurations()[0]); Assert.assert... |
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public List<JSON2DDestinations> getDestinations() { return destinations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSour... | @Test public void getDestinations() { Assert.assertEquals(3, distancesMatrixResponse.getDestinations().size()); Assert.assertArrayEquals(new Double[]{8.681495, 49.41461}, distancesMatrixResponse.getDestinations().get(0).getLocation()); } |
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDestinations(List<JSON2DDestinations> destinations) { this.destinations = destinations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(... | @Test public void setDestinations() { Coordinate coordinate = new Coordinate(9.681495, 50.41461); ResolvedLocation resolvedLocation = new ResolvedLocation(coordinate, "foo", 0.0); List<JSON2DDestinations> json2DDestinations = new ArrayList<>(); JSON2DDestinations json2DDestination = new JSON2DDestinations(resolvedLocat... |
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public List<JSON2DSources> getSources() { return sources; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[]... | @Test public void getSources() { Assert.assertEquals(3, durationsMatrixResponse.getSources().size()); Assert.assertArrayEquals(new Double[]{8.681495, 49.41461}, durationsMatrixResponse.getSources().get(0).getLocation()); } |
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setSources(List<JSON2DSources> sources) { this.sources = sources; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> ge... | @Test public void setSources() { Coordinate coordinate = new Coordinate(9.681495, 50.41461); ResolvedLocation resolvedLocation = new ResolvedLocation(coordinate, "foo", 0.0); List<JSON2DSources> json2DSources = new ArrayList<>(); JSON2DSources json2DSource = new JSON2DSources(resolvedLocation, false); json2DSources.add... |
JSON2DDestinations extends JSONLocation { @Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; } JSON2D... | @Test public void getLocation() { JSON2DDestinations json2DDestinationsWithLocation = new JSON2DDestinations(resolvedLocation, true); JSON2DDestinations json2DDestinationsWoLocation = new JSON2DDestinations(resolvedLocation, false); Assert.assertArrayEquals(new Double[]{8.681495, 49.41461}, json2DDestinationsWithLocati... |
JSON2DSources extends JSONLocation { @Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; } JSON2DSourc... | @Test public void getLocation() { JSON2DSources json2DSourcesWithLocation = new JSON2DSources(resolvedLocation, true); JSON2DSources json2DSourcesWoLocation = new JSON2DSources(resolvedLocation, false); Assert.assertArrayEquals(new Double[]{8.681495, 49.41461}, json2DSourcesWithLocation.getLocation()); Assert.assertArr... |
MatrixResponseInfo { public String getAttribution() { return attribution; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); } | @Test public void getAttributionTest() { Assert.assertEquals(MatrixResponseInfo.class, responseInformation.getClass()); Assert.assertEquals(String.class, responseInformation.getAttribution().getClass()); } |
MatrixResponseInfo { public String getService() { return service; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); } | @Test public void getServiceTest() { Assert.assertEquals("matrix", responseInformation.getService()); } |
MatrixResponseInfo { public long getTimeStamp() { return timeStamp; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); } | @Test public void getTimeStampTest() { Assert.assertTrue(Long.toString(responseInformation.getTimeStamp()).length() > 0); } |
MatrixResponseInfo { public MatrixRequest getRequest() { return request; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); } | @Test public void getRequestTest() { Assert.assertEquals(bareMatrixRequest, responseInformation.getRequest()); } |
MatrixResponseInfo { public EngineInfo getEngineInfo() { return engineInfo; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); } | @Test public void getEngineInfoTest() { Assert.assertNotNull(responseInformation.getEngineInfo()); } |
IsochronesResponse { public IsochronesResponseInfo getResponseInformation() { return responseInformation; } IsochronesResponse(IsochronesRequest request); IsochronesResponseInfo getResponseInformation(); BoundingBox getBbox(); } | @Test public void getResponseInformation() { } |
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orde... | @Test public void resolve_orderByChild() { OrderByClause orderByClause = new OrderByClause(); orderByClause.setOrderByMode(OrderByMode.ORDER_BY_CHILD); orderByClause.setArgument("test_argument"); Query query = PowerMockito.mock(Query.class); ResolverQueryOrderBy resolver = new ResolverQueryOrderBy(); resolver.resolve(o... |
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInWithToken(String token) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInWithCustomToken(token))); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmai... | @Test public void signInWithToken() { Auth auth = new Auth(); Consumer consumer = Mockito.mock(Consumer.class); Mockito.when(task.isSuccessful()).thenReturn(true); Mockito.doReturn(task).when(firebaseAuth).signInWithCustomToken(Mockito.anyString()); auth.signInWithToken("token") .then(consumer); PowerMockito.verifyStat... |
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInAnonymously() { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInAnonymously())); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String... | @Test public void signInAnonymously() { Auth auth = new Auth(); Consumer consumer = Mockito.mock(Consumer.class); Mockito.when(task.isSuccessful()).thenReturn(true); Mockito.doReturn(task).when(firebaseAuth).signInAnonymously(); auth.signInAnonymously() .then(consumer); PowerMockito.verifyStatic(FirebaseAuth.class, Ver... |
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }... | @Test public void signOut() { Auth auth = new Auth(); Consumer consumer = Mockito.mock(Consumer.class); auth.signOut().then(consumer); PowerMockito.verifyStatic(FirebaseAuth.class, VerificationModeFactory.times(1)); FirebaseAuth.getInstance(); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).signOut(); Mo... |
Auth implements AuthDistribution { @Override public Promise<Void> sendPasswordResetEmail(final String email) { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(final FuturePromise<Void> promise) { FirebaseAuth.getInstance().sendPasswordResetEmail(email) .addOnCompleteListener... | @Test public void sendPasswordResetEmail() { Auth auth = new Auth(); Consumer consumer = Mockito.mock(Consumer.class); Mockito.when(task.isSuccessful()).thenReturn(true); Mockito.doReturn(task).when(firebaseAuth).sendPasswordResetEmail(Mockito.anyString()); String arg1 = "email"; auth.sendPasswordResetEmail(arg1).then(... |
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] in... | @Test public void resolve_endAt() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.END_AT, query, "test"); Mockito.verify(query, VerificationModeFactory.times(1)).endAt(Mockito.eq("test")); }
@Test public void resolve_endAt2() { ResolverQueryFilter resolver = new ResolverQueryFilt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.