src/test/java/de/blau/android/util/GeoContextTest.java
/**
     * Test for elements in the UK
     */
Test for elements in the UK
Test for elements in the UK
@Test
    public void UK() {
        final CountDownLatch signal1 = new CountDownLatch(1);
        Logic logic = App.getLogic();
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        InputStream is = loader.getResourceAsStream("london.osm");
        logic.readOsmFile(ApplicationProvider.getApplicationContext(), is, false, new SignalHandler(signal1));
        try {
            signal1.await(ApiTest.TIMEOUT, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
            Assert.fail(e.getMessage());
        }
        try {
            is.close();
        } catch (IOException e1) {
        }
        Way w = (Way) App.getDelegator().getOsmElement(Way.NAME, 451984385L);
        Assert.assertNotNull(w);
        GeoContext geoContext = App.getGeoContext(ApplicationProvider.getApplicationContext());
        Assert.assertTrue(geoContext.imperial(w));
        Assert.assertTrue(geoContext.driveLeft(w));
        Assert.assertTrue(geoContext.getIsoCodes(w).contains("GB"));
        Node n = (Node) App.getDelegator().getOsmElement(Node.NAME, 1012733590L);
        Assert.assertNotNull(n);
        Assert.assertTrue(geoContext.imperial(n));
        Assert.assertTrue(geoContext.driveLeft(n));
        Assert.assertTrue(geoContext.getIsoCodes(n).contains("GB"));
    }
@ Test public void UK ( ) { final CountDownLatch signal1 = new CountDownLatch ( 1 ) ; Logic logic = App . getLogic ( ) ; ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; InputStream is = loader . getResourceAsStream ( "london.osm" ) ; logic . readOsmFile ( ApplicationProvider . getApplicationContext ( ) , is , false , new SignalHandler ( signal1 ) ) ; try { signal1 . await ( ApiTest . TIMEOUT , TimeUnit . SECONDS ) ; } catch ( InterruptedException e ) { Assert . fail ( e . getMessage ( ) ) ; } try { is . close ( ) ; } catch ( IOException e1 ) { } Way w = ( Way ) App . getDelegator ( ) . getOsmElement ( Way . NAME , 451984385L ) ; Assert . assertNotNull ( w ) ; GeoContext geoContext = App . getGeoContext ( ApplicationProvider . getApplicationContext ( ) ) ; Assert . assertTrue ( geoContext . imperial ( w ) ) ; Assert . assertTrue ( geoContext . driveLeft ( w ) ) ; Assert . assertTrue ( geoContext . getIsoCodes ( w ) . contains ( "GB" ) ) ; Node n = ( Node ) App . getDelegator ( ) . getOsmElement ( Node . NAME , 1012733590L ) ; Assert . assertNotNull ( n ) ; Assert . assertTrue ( geoContext . imperial ( n ) ) ; Assert . assertTrue ( geoContext . driveLeft ( n ) ) ; Assert . assertTrue ( geoContext . getIsoCodes ( n ) . contains ( "GB" ) ) ; }
Test for elements in the UK
Test for elements in the UK