diff --git a/test/unit/org/openstreetmap/josm/gui/widgets/HistoryComboBoxTest.java b/test/unit/org/openstreetmap/josm/gui/widgets/HistoryComboBoxTest.java
index 6475b5d1bd..fd2d914a1f 100644
|
a
|
b
|
class HistoryComboBoxTest {
|
| 44 | 44 | historyComboBox.getEditor().setItem(null); |
| 45 | 45 | assertDoesNotThrow(historyComboBox::addCurrentItemToHistory); |
| 46 | 46 | } |
| | 47 | |
| | 48 | /** |
| | 49 | * Non-regression test for JOSM #21215 |
| | 50 | */ |
| | 51 | @Test |
| | 52 | void testNonRegression21215() { |
| | 53 | final HistoryComboBox historyComboBox = new HistoryComboBox(); |
| | 54 | // utils plugin2 added a listener that pretty much did this |
| | 55 | historyComboBox.addItemListener(event -> historyComboBox.addCurrentItemToHistory()); |
| | 56 | final AutoCompletionItem testItem = new AutoCompletionItem("testNonRegression21215"); |
| | 57 | // Add the original item |
| | 58 | historyComboBox.getEditor().setItem(testItem); |
| | 59 | historyComboBox.addCurrentItemToHistory(); |
| | 60 | |
| | 61 | // add a new item |
| | 62 | historyComboBox.getEditor().setItem(new AutoCompletionItem("testNonRegression21215_2")); |
| | 63 | historyComboBox.addCurrentItemToHistory(); |
| | 64 | |
| | 65 | // Readd the first item |
| | 66 | historyComboBox.getEditor().setItem(testItem); |
| | 67 | assertDoesNotThrow(historyComboBox::addCurrentItemToHistory); |
| | 68 | } |
| 47 | 69 | } |