Changeset 9753 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2016-02-07T18:08:55+01:00 (6 years ago)
Author:
Don-vip
Message:

add unit tests

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java

    r9742 r9753  
    7777    }
    7878
     79    /**
     80     * Unit test of {@link CorrelateGpxWithImages.Timezone#formatTimezone}.
     81     */
    7982    @Test
    80     public void testFormatTimezone() throws Exception {
     83    public void testFormatTimezone() {
    8184        assertEquals("+1:00", new CorrelateGpxWithImages.Timezone(1).formatTimezone());
    8285        assertEquals("+6:30", new CorrelateGpxWithImages.Timezone(6.5).formatTimezone());
     
    8689    }
    8790
     91    /**
     92     * Unit test of {@link CorrelateGpxWithImages.Timezone#parseTimezone}.
     93     * @throws ParseException in case of parsing error
     94     */
    8895    @Test
    8996    public void testParseTimezone() throws ParseException {
     
    94101    }
    95102
     103    /**
     104     * Unit test of {@link CorrelateGpxWithImages.Offset#formatOffset}.
     105     */
    96106    @Test
    97     public void testFormatOffest() throws ParseException {
     107    public void testFormatOffset() {
    98108        assertEquals("0", CorrelateGpxWithImages.Offset.seconds(0).formatOffset());
    99109        assertEquals("123", CorrelateGpxWithImages.Offset.seconds(123).formatOffset());
     
    106116    }
    107117
     118    /**
     119     * Unit test of {@link CorrelateGpxWithImages.Offset#parseOffset}.
     120     * @throws ParseException in case of parsing error
     121     */
    108122    @Test
    109123    public void testParseOffest() throws ParseException {
     
    117131    }
    118132
     133    /**
     134     * Unit test of {@link CorrelateGpxWithImages.Offset#splitOutTimezone}.
     135     */
    119136    @Test
    120     public void testSplitOutTimezone() throws Exception {
     137    public void testSplitOutTimezone() {
    121138        assertEquals("+1:00", CorrelateGpxWithImages.Offset.seconds(3602).splitOutTimezone().a.formatTimezone());
    122139        assertEquals("2", CorrelateGpxWithImages.Offset.seconds(3602).splitOutTimezone().b.formatOffset());
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java

    r8876 r9753  
    1818import org.openstreetmap.josm.gui.layer.ImageryLayer;
    1919import org.openstreetmap.josm.gui.layer.Layer;
     20import org.openstreetmap.josm.gui.layer.NoteLayer;
    2021import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2122import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
     
    129130        assertEquals(image.getDy(), -56.78, 1e-9);
    130131    }
     132
     133    /**
     134     * Tests to read a .joz file containing notes.
     135     * @throws IOException if any I/O error occurs
     136     * @throws IllegalDataException is the test file is considered as invalid
     137     */
     138    @Test
     139    public void testReadNotes() throws IOException, IllegalDataException {
     140        final List<Layer> layers = testRead("notes.joz");
     141        assertSame(layers.size(), 1);
     142        assertTrue(layers.get(0) instanceof NoteLayer);
     143        final NoteLayer layer = (NoteLayer) layers.get(0);
     144        assertEquals("Notes", layer.getName());
     145        assertEquals(174, layer.getNoteData().getNotes().size());
     146    }
    131147}
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java

    r9296 r9753  
    1919import org.openstreetmap.josm.data.gpx.WayPoint;
    2020import org.openstreetmap.josm.data.imagery.ImageryInfo;
     21import org.openstreetmap.josm.data.notes.Note;
    2122import org.openstreetmap.josm.data.osm.DataSet;
    2223import org.openstreetmap.josm.gui.layer.GpxLayer;
    2324import org.openstreetmap.josm.gui.layer.ImageryLayer;
    2425import org.openstreetmap.josm.gui.layer.Layer;
     26import org.openstreetmap.josm.gui.layer.NoteLayer;
    2527import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2628import org.openstreetmap.josm.gui.layer.TMSLayer;
     
    139141    }
    140142
     143    private NoteLayer createNoteLayer() {
     144        return new NoteLayer(Arrays.asList(new Note(LatLon.ZERO)), "layer name");
     145    }
     146
    141147    /**
    142148     * Tests to write an empty .jos file.
     
    204210        testWrite(Collections.singletonList(layer), true);
    205211    }
     212
     213    /**
     214     * Tests to write a .joz file containing a note layer.
     215     */
     216    @Test
     217    public void testWriteNoteLayer() {
     218        final Layer layer = createNoteLayer();
     219        testWrite(Collections.singletonList(layer), true);
     220    }
    206221}
Note: See TracChangeset for help on using the changeset viewer.