From 71827daeea1c379262ff173621d1ed5cef9da44e Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 22 Sep 2020 17:32:25 +0300 Subject: [PATCH] test added --- .../net/osmand/router/RouteTestingTest.java | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java b/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java index cf43602528..06e6ef8fda 100644 --- a/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java +++ b/OsmAnd-java/src/test/java/net/osmand/router/RouteTestingTest.java @@ -30,34 +30,34 @@ public class RouteTestingTest { private TestEntry te; - public RouteTestingTest(String name, TestEntry te) { - this.te = te; - } + public RouteTestingTest(String name, TestEntry te) { + this.te = te; + } - @BeforeClass - public static void setUp() throws Exception { - RouteResultPreparation.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = true; - } + @BeforeClass + public static void setUp() throws Exception { + RouteResultPreparation.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = true; + } - @Parameterized.Parameters(name = "{index}: {0}") - public static Iterable data() throws IOException { - String fileName = "/test_routing.json"; - Reader reader = new InputStreamReader(RouteTestingTest.class.getResourceAsStream(fileName)); - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - TestEntry[] testEntries = gson.fromJson(reader, TestEntry[].class); - ArrayList arrayList = new ArrayList<>(); - for(TestEntry te : testEntries) { - if(te.isIgnore()) { - continue; - } - arrayList.add(new Object[] {te.getTestName(), te}); - } - reader.close(); - return arrayList; + @Parameterized.Parameters(name = "{index}: {0}") + public static Iterable data() throws IOException { + String fileName = "/test_routing.json"; + Reader reader = new InputStreamReader(RouteTestingTest.class.getResourceAsStream(fileName)); + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + TestEntry[] testEntries = gson.fromJson(reader, TestEntry[].class); + ArrayList arrayList = new ArrayList<>(); + for (TestEntry te : testEntries) { + if (te.isIgnore()) { + continue; + } + arrayList.add(new Object[]{te.getTestName(), te}); + } + reader.close(); + return arrayList; - } + } - @Test + @Test public void testRouting() throws Exception { String fl = "src/test/resources/Routing_test.obf"; RandomAccessFile raf = new RandomAccessFile(fl, "r"); @@ -66,15 +66,14 @@ public class RouteTestingTest { BinaryMapIndexReader[] binaryMapIndexReaders;// = { new BinaryMapIndexReader(raf, new File(fl)) }; RoutingConfiguration.Builder builder = RoutingConfiguration.getDefault(); Map params = te.getParams(); - if (params.containsKey("map")){ + if (params.containsKey("map")) { String fl1 = "src/test/resources/" + params.get("map"); RandomAccessFile raf1 = new RandomAccessFile(fl1, "r"); binaryMapIndexReaders = new BinaryMapIndexReader[]{ new BinaryMapIndexReader(raf1, new File(fl1)), new BinaryMapIndexReader(raf, new File(fl)) }; - } - else { + } else { binaryMapIndexReaders = new BinaryMapIndexReader[]{new BinaryMapIndexReader(raf, new File(fl))}; } RoutingConfiguration config = builder.build(params.containsKey("vehicle") ? params.get("vehicle") : "car",