src/androidTest/java/de/blau/android/propertyeditor/PropertyEditorTest.java
/**
     * Test that keys with empty values get removed
     */
Test that keys with empty values get removed
Test that keys with empty values get removed
@Test
    public void emptyKey() {
        final CountDownLatch signal = new CountDownLatch(1);
        mockServer.enqueue("capabilities1");
        mockServer.enqueue("download1");
        Logic logic = App.getLogic();
        logic.downloadBox(main, new BoundingBox(8.3879800D, 47.3892400D, 8.3844600D, 47.3911300D), false, new SignalHandler(signal));
        try {
            signal.await(30, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
            fail(e.getMessage());
        }
        Node n = (Node) logic.performAddNode(main, 1.0, 1.0);
        assertNotNull(n);
        main.performTagEdit(n, null, false, false);
        Activity propertyEditor = instrumentation.waitForMonitorWithTimeout(monitor, 30000);
        assertTrue(propertyEditor instanceof PropertyEditor);
        TestUtils.clickText(device, true, main.getString(R.string.tag_details), false, false);
        device.wait(Until.findObject(By.clickable(true).res(device.getCurrentPackageName() + ":id/editValue")), 500);
        UiObject editText = device.findObject(new UiSelector().clickable(true).resourceId(device.getCurrentPackageName() + ":id/editValue"));
        String edited = "edited";
        try {
            editText.click(); 
            editText.setText(edited);
        } catch (UiObjectNotFoundException e) {
            fail(e.getMessage());
        }
        TestUtils.clickHome(device, true);
        assertFalse(n.hasTag("", edited));
    }
@ Test public void emptyKey ( ) { final CountDownLatch signal = new CountDownLatch ( 1 ) ; mockServer . enqueue ( "capabilities1" ) ; mockServer . enqueue ( "download1" ) ; Logic logic = App . getLogic ( ) ; logic . downloadBox ( main , new BoundingBox ( 8.3879800D , 47.3892400D , 8.3844600D , 47.3911300D ) , false , new SignalHandler ( signal ) ) ; try { signal . await ( 30 , TimeUnit . SECONDS ) ; } catch ( InterruptedException e ) { fail ( e . getMessage ( ) ) ; } Node n = ( Node ) logic . performAddNode ( main , 1.0 , 1.0 ) ; assertNotNull ( n ) ; main . performTagEdit ( n , null , false , false ) ; Activity propertyEditor = instrumentation . waitForMonitorWithTimeout ( monitor , 30000 ) ; assertTrue ( propertyEditor instanceof PropertyEditor ) ; TestUtils . clickText ( device , true , main . getString ( R . string . tag_details ) , false , false ) ; device . wait ( Until . findObject ( By . clickable ( true ) . res ( device . getCurrentPackageName ( ) + ":id/editValue" ) ) , 500 ) ; UiObject editText = device . findObject ( new UiSelector ( ) . clickable ( true ) . resourceId ( device . getCurrentPackageName ( ) + ":id/editValue" ) ) ; String edited = "edited" ; try { editText . click ( ) ; editText . setText ( edited ) ; } catch ( UiObjectNotFoundException e ) { fail ( e . getMessage ( ) ) ; } TestUtils . clickHome ( device , true ) ; assertFalse ( n . hasTag ( "" , edited ) ) ; }
Test that keys with empty values get removed
Test that keys with empty values get removed
// NOTE this seems to be necessary