Changeset 14125 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2018-08-11T19:01:26+02:00 (6 years ago)
Author:
Don-vip
Message:

see #15229 - extract lifecycle Main classes to a new lifecycle SPI

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java

    r14120 r14125  
    151151    }
    152152
    153     @SuppressWarnings("deprecation")
    154153    private void setupGUI() {
    155154        JOSMTestRules.cleanLayerEnvironment();
  • trunk/test/unit/org/openstreetmap/josm/MainTest.java

    r14121 r14125  
    22package org.openstreetmap.josm;
    33
    4 import static org.junit.Assert.assertFalse;
    54import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertTrue;
    75
    86import org.junit.Rule;
    97import org.junit.Test;
    10 import org.openstreetmap.josm.Main.InitStatusListener;
    11 import org.openstreetmap.josm.Main.InitializationTask;
    128import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager;
    139import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    3531        assertNotNull(CoordinateFormatManager.getDefaultFormat());
    3632    }
    37 
    38     private static class InitStatusListenerStub implements InitStatusListener {
    39 
    40         boolean updated;
    41         boolean finished;
    42 
    43         @Override
    44         public Object updateStatus(String event) {
    45             updated = true;
    46             return null;
    47         }
    48 
    49         @Override
    50         public void finish(Object status) {
    51             finished = true;
    52         }
    53     }
    54 
    55     /**
    56      * Unit test of {@link Main#setInitStatusListener}.
    57      */
    58     @Test
    59     public void testSetInitStatusListener() {
    60         InitStatusListenerStub listener = new InitStatusListenerStub();
    61         Main.setInitStatusListener(listener);
    62         assertFalse(listener.updated);
    63         assertFalse(listener.finished);
    64         new InitializationTask("", () -> { }).call();
    65         assertTrue(listener.updated);
    66         assertTrue(listener.finished);
    67     }
    6833}
Note: See TracChangeset for help on using the changeset viewer.