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


Ignore:
Timestamp:
2026-04-11T20:56:38+02:00 (4 days ago)
Author:
gaben
Message:

show a message when no plugins are installed

File:
1 edited

Legend:

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

    r18037 r19565  
    1414import java.util.stream.Stream;
    1515
     16import javax.swing.JLabel;
    1617import javax.swing.JOptionPane;
     18import javax.swing.JPanel;
    1719import javax.swing.JScrollPane;
    1820
     
    174176        assertEquals("Plugin information", invocationLogEntry[2]);
    175177    }
     178
     179    /**
     180     * Unit test of {@link PluginHandler#getInfoPanel}.
     181     */
     182    @Test
     183    void testGetInfoPanel() {
     184        JPanel panel = PluginHandler.getInfoPanel();
     185        assertNotNull(panel);
     186
     187        assertTrue(PluginHandler.getPlugins().isEmpty());
     188
     189        // if no plugins are loaded in the test environment, the panel should show "No plugins installed"
     190        boolean found = Arrays.stream(panel.getComponents())
     191            .filter(JLabel.class::isInstance)
     192            .map(JLabel.class::cast)
     193            .anyMatch(l -> l.getText().equals("No plugins installed"));
     194        assertTrue(found, "Should find 'No plugins installed' label");
     195    }
    176196}
Note: See TracChangeset for help on using the changeset viewer.