Changeset 16682 in josm for trunk/test/unit
- Timestamp:
- 2020-06-19T20:36:27+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java
r16574 r16682 10 10 import static org.junit.Assert.assertTrue; 11 11 import static org.junit.Assert.fail; 12 12 import static org.junit.jupiter.api.Assertions.assertThrows; 13 14 import java.io.PrintWriter; 15 import java.io.StringWriter; 13 16 import java.util.ArrayList; 14 17 import java.util.Arrays; … … 27 30 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 28 31 import org.openstreetmap.josm.testutils.JOSMTestRules; 32 import org.openstreetmap.josm.tools.bugreport.ReportedException; 29 33 30 34 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 313 317 assertEquals(new SequenceCommand("foo", command1, command2), SequenceCommand.wrapIfNeeded("foo", command1, command2)); 314 318 } 319 320 /** 321 * Test SequenceCommand#createReportedException 322 */ 323 @Test 324 public void testCreateReportedException() { 325 DataSet ds = new DataSet(); 326 Command c1 = new TestCommand(ds, Collections.emptyList()) { 327 @Override 328 public boolean executeCommand() { 329 fail("foo"); 330 return false; 331 } 332 333 @Override 334 public String getDescriptionText() { 335 return "foo command"; 336 } 337 }; 338 SequenceCommand command = new SequenceCommand("test", c1); 339 ReportedException reportedException = assertThrows(ReportedException.class, command::executeCommand); 340 StringWriter stringWriter = new StringWriter(); 341 reportedException.printReportDataTo(new PrintWriter(stringWriter)); 342 assertEquals("=== REPORTED CRASH DATA ===\n" + 343 "sequence_information:\n" + 344 " - sequence_name: Sequence: test\n" + 345 " - sequence_command: foo command\n" + 346 " - sequence_index: 0\n" + 347 " - sequence_commands: [null]\n" + 348 " - sequence_commands_descriptions: [foo command]\n" + 349 "\n", stringWriter.toString()); 350 } 315 351 }
Note:
See TracChangeset
for help on using the changeset viewer.