Changeset 17714 in josm for trunk/test
- Timestamp:
- 2021-04-07T23:41:13+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/NotesDialogTest.java
r17712 r17714 3 3 4 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 5 7 6 8 import java.time.Instant; … … 32 34 public JOSMTestRules josmTestRules = new JOSMTestRules().preferences(); 33 35 34 @Test 35 void testMultiLineNoteRendering() { 36 private Note createMultiLineNote() { 36 37 Note note = new Note(LatLon.ZERO); 37 38 note.setCreatedAt(Instant.now()); 38 39 note.addComment(new NoteComment(Instant.now(), User.createLocalUser(null), "foo\nbar\n\nbaz:\nfoo", null, false)); 40 return note; 41 } 42 43 /** 44 * Unit test of {@link NoteRenderer} 45 */ 46 @Test 47 void testMultiLineNoteRendering() { 48 Note note = createMultiLineNote(); 39 49 assertEquals("0: foo; bar; baz: foo", 40 50 ((JLabel) new NoteRenderer().getListCellRendererComponent(new JList<>(), note, 0, false, false)).getText()); 41 51 } 52 53 /** 54 * Unit test of {@link NotesDialog#matchesNote} 55 */ 56 @Test 57 void testMatchesNote() { 58 Note note = createMultiLineNote(); 59 assertTrue(NotesDialog.matchesNote(null, note)); 60 assertTrue(NotesDialog.matchesNote("", note)); 61 assertTrue(NotesDialog.matchesNote("foo", note)); 62 assertFalse(NotesDialog.matchesNote("xxx", note)); 63 assertFalse(NotesDialog.matchesNote("open", note)); 64 assertFalse(NotesDialog.matchesNote("new", note)); 65 assertFalse(NotesDialog.matchesNote("reopened", note)); 66 } 42 67 }
Note:
See TracChangeset
for help on using the changeset viewer.