Changeset 18128 in josm for trunk/test/unit/org/openstreetmap/josm/gui/widgets/HistoryComboBoxTest.java
- Timestamp:
- 2021-08-07T00:40:05+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/widgets/HistoryComboBoxTest.java
r18126 r18128 4 4 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 5 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertThrows;7 6 8 7 import java.util.stream.Stream; … … 22 21 class HistoryComboBoxTest { 23 22 static Stream<Arguments> testNonRegression21203() { 24 return Stream.of(Arguments.of("Hello world"), Arguments.of(new AutoCompletionItem("Hello world2")) );23 return Stream.of(Arguments.of("Hello world"), Arguments.of(new AutoCompletionItem("Hello world2")), Arguments.of(new Double(42))); 25 24 } 26 25 … … 39 38 } 40 39 41 /**42 * This ensures that we do throw on unknown objects for #2120343 */44 40 @Test 45 void test NonRegression21203Throws() {41 void testEmptyEditor() { 46 42 final HistoryComboBox historyComboBox = new HistoryComboBox(); 47 // Sanity check 48 assertEquals(0, historyComboBox.getModel().getSize()); 49 historyComboBox.getEditor().setItem(new Object()); 50 IllegalArgumentException illegalArgumentException = assertThrows(IllegalArgumentException.class, 51 historyComboBox::addCurrentItemToHistory); 52 assertEquals("Object is not supported in addCurrentItemToHistory", illegalArgumentException.getMessage()); 43 assertDoesNotThrow(historyComboBox::addCurrentItemToHistory); 44 historyComboBox.getEditor().setItem(null); 45 assertDoesNotThrow(historyComboBox::addCurrentItemToHistory); 53 46 } 54 47 }
Note:
See TracChangeset
for help on using the changeset viewer.