Changeset 10210 in josm for trunk/test


Ignore:
Timestamp:
2016-05-14T15:45:35+02:00 (4 years ago)
Author:
Don-vip
Message:

see #11924 - Java 9 - replace calls to deprecated classes java.util.Observable / java.util.Observer by a new class ChangeNotifier + swing's ChangeListener

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModelTest.java

    r9973 r10210  
    66import static org.junit.Assert.assertTrue;
    77
    8 import java.util.Observable;
    9 import java.util.Observer;
     8import javax.swing.event.ChangeEvent;
     9import javax.swing.event.ChangeListener;
    1010
    1111import org.junit.Before;
     
    2424public class PropertiesMergeModelTest {
    2525
    26     private abstract static class TestObserver implements Observer {
     26    private abstract static class TestChangeListener implements ChangeListener {
    2727        public int numInvocations;
    2828
    2929        @Override
    30         public void update(Observable o, Object arg) {
     30        public void stateChanged(ChangeEvent e) {
    3131            numInvocations++;
    3232            doTest();
     
    113113        // decide KEEP_MINE  and ensure notification via Observable
    114114        //
    115         TestObserver observerTest;
    116         model.addObserver(
    117                 observerTest = new TestObserver() {
     115        TestChangeListener observerTest;
     116        model.addChangeListener(
     117                observerTest = new TestChangeListener() {
    118118                    @Override
    119119                    public void doTest() {
     
    128128        // decide KEEP_THEIR and  ensure notification via Observable
    129129        //
    130         model.deleteObserver(observerTest);
    131         model.addObserver(
    132                 observerTest = new TestObserver() {
     130        model.removeChangeListener(observerTest);
     131        model.addChangeListener(
     132                observerTest = new TestChangeListener() {
    133133                    @Override
    134134                    public void doTest() {
     
    140140        assertTrue(model.isCoordMergeDecision(MergeDecisionType.KEEP_THEIR));
    141141        observerTest.assertNumInvocations(1);
    142         model.deleteObserver(observerTest);
     142        model.removeChangeListener(observerTest);
    143143    }
    144144}
Note: See TracChangeset for help on using the changeset viewer.