src/test/java/de/blau/android/presets/PresetTest.java
/**
     * Test including / excluding PresetItems based on country
     */
Test including / excluding PresetItems based on country
Test including / excluding PresetItems based on country
@Test
    public void includeExcludeCountry() {
        PresetItem motorVehicleCH = presets[0].getItemByName("Motor vehicle (CH)", null);
        assertNotNull(motorVehicleCH);
        motorVehicleCH.setRegions("CH");
        PresetItem motorVehicle = presets[0].getItemByName("Motor vehicle", null);
        assertNotNull(motorVehicle);
        motorVehicle.setRegions("CH");
        motorVehicle.setExcludeRegions(true);
        List<PresetElement> result = SearchIndexUtils.searchInPresets(ApplicationProvider.getApplicationContext(), "motor vehicle", ElementType.WAY, 2, 10,
                null);
        assertTrue(result.contains(motorVehicleCH));
        assertTrue(result.contains(motorVehicle));
        result = SearchIndexUtils.searchInPresets(ApplicationProvider.getApplicationContext(), "motor vehicle", ElementType.WAY, 2, 10,
                de.blau.android.util.Util.wrapInList("CH"));
        assertTrue(result.contains(motorVehicleCH));
        assertFalse(result.contains(motorVehicle));
        result = SearchIndexUtils.searchInPresets(ApplicationProvider.getApplicationContext(), "motor vehicle", ElementType.WAY, 2, 10,
                de.blau.android.util.Util.wrapInList("DE"));
        assertFalse(result.contains(motorVehicleCH));
        assertTrue(result.contains(motorVehicle));
    }
@ Test public void includeExcludeCountry ( ) { PresetItem motorVehicleCH = presets [ 0 ] . getItemByName ( "Motor vehicle (CH)" , null ) ; assertNotNull ( motorVehicleCH ) ; motorVehicleCH . setRegions ( "CH" ) ; PresetItem motorVehicle = presets [ 0 ] . getItemByName ( "Motor vehicle" , null ) ; assertNotNull ( motorVehicle ) ; motorVehicle . setRegions ( "CH" ) ; motorVehicle . setExcludeRegions ( true ) ; List < PresetElement > result = SearchIndexUtils . searchInPresets ( ApplicationProvider . getApplicationContext ( ) , "motor vehicle" , ElementType . WAY , 2 , 10 , null ) ; assertTrue ( result . contains ( motorVehicleCH ) ) ; assertTrue ( result . contains ( motorVehicle ) ) ; result = SearchIndexUtils . searchInPresets ( ApplicationProvider . getApplicationContext ( ) , "motor vehicle" , ElementType . WAY , 2 , 10 , de . blau . android . util . Util . wrapInList ( "CH" ) ) ; assertTrue ( result . contains ( motorVehicleCH ) ) ; assertFalse ( result . contains ( motorVehicle ) ) ; result = SearchIndexUtils . searchInPresets ( ApplicationProvider . getApplicationContext ( ) , "motor vehicle" , ElementType . WAY , 2 , 10 , de . blau . android . util . Util . wrapInList ( "DE" ) ) ; assertFalse ( result . contains ( motorVehicleCH ) ) ; assertTrue ( result . contains ( motorVehicle ) ) ; }
Test including / excluding PresetItems based on country
Test including / excluding PresetItems based on country