Changeset 14102 in josm for trunk


Ignore:
Timestamp:
2018-08-07T19:50:47+02:00 (6 years ago)
Author:
Don-vip
Message:

update unit test

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/NoteData.java

    r14101 r14102  
    5151
    5252    /**
    53      * Construct a new note container with a given list of notes
     53     * Construct a new note container without notes
    5454     * @since 14101
    5555     */
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java

    r13150 r14102  
    277277        @Override
    278278        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    279             FilterTableModel model = (FilterTableModel) table.getModel();
    280279            Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    281             cell.setEnabled(model.isCellEnabled(row, column));
     280            TableModel model = table.getModel();
     281            if (model instanceof FilterTableModel) {
     282                cell.setEnabled(((FilterTableModel) model).isCellEnabled(row, column));
     283            }
    282284            return cell;
    283285        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r14097 r14102  
    813813            if (c instanceof JLabel) {
    814814                JLabel label = (JLabel) c;
    815                 label.setText(((MemberInfo) table.getValueAt(row, 1)).getPositionString());
     815                MemberInfo member = (MemberInfo) table.getValueAt(row, 1);
     816                if (member != null) {
     817                    label.setText(member.getPositionString());
     818                }
    816819                if (isDisabledAndHidden) {
    817820                    label.setFont(label.getFont().deriveFont(Font.ITALIC));
  • trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java

    r14101 r14102  
    1919import java.util.Collections;
    2020import java.util.List;
     21import java.util.Objects;
    2122import java.util.regex.Matcher;
    2223import java.util.regex.Pattern;
     
    9798     */
    9899    public NoteLayer(Collection<Note> notes, String name) {
    99         super(name);
    100         noteData = new NoteData(notes);
    101         noteData.addNoteDataUpdateListener(this);
     100        this(new NoteData(notes), name);
    102101    }
    103102
     
    110109    public NoteLayer(NoteData noteData, String name) {
    111110        super(name);
    112         this.noteData = noteData;
     111        this.noteData = Objects.requireNonNull(noteData);
    113112        this.noteData.addNoteDataUpdateListener(this);
    114113    }
  • trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java

    r14100 r14102  
    99import java.util.Collection;
    1010import java.util.Set;
     11import java.util.logging.Level;
    1112
    1213import javax.swing.JTable;
     
    1819import org.openstreetmap.josm.TestUtils;
    1920import org.openstreetmap.josm.testutils.JOSMTestRules;
     21import org.openstreetmap.josm.tools.Logging;
    2022import org.openstreetmap.josm.tools.Utils;
    2123
     
    7173                continue;
    7274            }
    73             assertNotNull(createInstance(klass).getTableCellRendererComponent(tbl, null, false, false, 0, 0));
     75            try {
     76                Logging.info(klass.toString());
     77                assertNotNull(createInstance(klass).getTableCellRendererComponent(tbl, null, false, false, 0, 0));
     78            } catch (ReflectiveOperationException e) {
     79                Logging.logWithStackTrace(Level.WARNING, "Unable to test " + klass, e);
     80            }
    7481        }
    7582    }
Note: See TracChangeset for help on using the changeset viewer.