Changeset 7365 in josm for trunk/test/unit/org/openstreetmap


Ignore:
Timestamp:
2014-08-04T00:34:17+02:00 (10 years ago)
Author:
Don-vip
Message:

code refactorization for non-regression tests

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/TestUtils.java

    r7356 r7365  
    2222    /**
    2323     * Returns the path to test data root directory.
     24     * @return path to test data root directory
    2425     */
    2526    public static String getTestDataRoot() {
     
    3031        }
    3132        return testDataRoot.endsWith("/") ? testDataRoot : testDataRoot + "/";
     33    }
     34
     35    /**
     36     * Gets path to test data directory for given ticket id.
     37     * @param ticketid Ticket numeric identifier
     38     * @return path to test data directory for given ticket id
     39     */
     40    public static String getRegressionDataDir(int ticketid) {
     41        return TestUtils.getTestDataRoot() + "/regress/" + ticketid;
     42    }
     43
     44    /**
     45     * Gets path to given file in test data directory for given ticket id.
     46     * @param ticketid Ticket numeric identifier
     47     * @param filename File name
     48     * @return path to given file in test data directory for given ticket id
     49     */
     50    public static String getRegressionDataFile(int ticketid, String filename) {
     51        return getRegressionDataDir(ticketid) + '/' + filename;
    3252    }
    3353
  • trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java

    r7356 r7365  
    5555        Comparator<Relation> comparator = DefaultNameFormatter.getInstance().getRelationComparator();
    5656
    57         try (InputStream is = new FileInputStream(TestUtils.getTestDataRoot() + "regress/9632/data.osm.zip")) {
     57        try (InputStream is = new FileInputStream(TestUtils.getRegressionDataFile(9632, "data.osm.zip"))) {
    5858            DataSet ds = OsmReader.parseDataSet(Compression.ZIP.getUncompressedInputStream(is), null);
    5959
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/TaggingPresetReaderTest.java

    r7081 r7365  
    3232
    3333    /**
    34      * Gets path to test data directory for given ticketid.
    35      * @param ticketid
    36      * @return
    37      */
    38     protected static String getRegressionDataDir(int ticketid) {
    39         return TestUtils.getTestDataRoot() + "/regress/" + ticketid;
    40     }
    41 
    42     /**
    43      * Gets path to given file in test data directory for given ticketid.
    44      * @param ticketid
    45      * @param filename
    46      * @return
    47      */
    48     protected static String getRegressionDataFile(int ticketid, String filename) {
    49         return getRegressionDataDir(ticketid) + '/' + filename;
    50     }
    51 
    52     /**
    5334     * #8954 - last checkbox in the preset is not added
    5435     */
    5536    @Test
    5637    public void test8954() throws SAXException, IOException {
    57         String presetfile = getRegressionDataFile(8954, "preset.xml");
     38        String presetfile = TestUtils.getRegressionDataFile(8954, "preset.xml");
    5839        final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(presetfile, false);
    5940        Assert.assertEquals("Number of preset items", 1, presets.size());
  • trunk/test/unit/org/openstreetmap/josm/tools/ImageProviderTest.java

    r7134 r7365  
    2323    @Test
    2424    public void testTicket9984() throws IOException {
    25         File file = new File(TestUtils.getTestDataRoot()+"regress/9984/tile.png");
     25        File file = new File(TestUtils.getRegressionDataFile(9984, "tile.png"));
    2626        assertThat(ImageProvider.read(file, true, true).getTransparency(), is(Transparency.TRANSLUCENT));
    2727        assertThat(ImageProvider.read(file, false, true).getTransparency(), is(Transparency.TRANSLUCENT));
     
    3636    @Test
    3737    public void testTicket10030() throws IOException {
    38         File file = new File(TestUtils.getTestDataRoot()+"regress/10030/tile.jpg");
     38        File file = new File(TestUtils.getRegressionDataFile(10030, "tile.jpg"));
    3939        ImageProvider.read(file, true, true);
    4040    }
Note: See TracChangeset for help on using the changeset viewer.