source: josm/test/unit/org/openstreetmap/josm/io/IncompleteDownloaderTest.java@ 298

Last change on this file since 298 was 298, checked in by imi, 17 years ago
  • added license description to head of each source file
File size: 1.3 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.io;
3
4import java.io.ByteArrayInputStream;
5import java.io.InputStream;
6import java.util.LinkedList;
7
8import org.openstreetmap.josm.Main;
9import org.openstreetmap.josm.data.osm.Segment;
10import org.openstreetmap.josm.data.osm.Way;
11import org.openstreetmap.josm.gui.PleaseWaitDialog;
12import org.openstreetmap.josm.testframework.Bug;
13import org.openstreetmap.josm.testframework.MotherObject;
14
15public class IncompleteDownloaderTest extends MotherObject {
16
17
18 @Bug(174)
19 public void testDownloadDoesNotWriteToMainDataDirectly() throws Exception {
20 LinkedList<Way> l = new LinkedList<Way>();
21 Way w = new Way();
22 w.segments.add(new Segment(23)); // incomplete segment
23 Main.ds.nodes.add(createNode(1));
24 Main.ds.nodes.add(createNode(2));
25 l.add(w);
26 IncompleteDownloader downloader = new IncompleteDownloader(l) {
27 @Override protected InputStream getInputStream(String urlStr, PleaseWaitDialog pleaseWaitDlg) {
28 String xml = "<osm version='0.4'><segment id='23' from='1' to='2'/></osm>";
29 return new ByteArrayInputStream(xml.getBytes());
30 }
31 };
32
33 Main.pleaseWaitDlg = new PleaseWaitDialog(null);
34
35 downloader.parse();
36
37 assertEquals("Does not directly write to main data", 0, Main.ds.segments.size());
38 }
39}
Note: See TracBrowser for help on using the repository browser.