Changeset 7366 in josm


Ignore:
Timestamp:
2014-08-04T19:00:18+02:00 (5 years ago)
Author:
Don-vip
Message:

add more info in case of test fixture creation fails

File:
1 edited

Legend:

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

    r7085 r7366  
    55
    66import java.io.File;
     7import java.nio.file.Paths;
    78import java.text.MessageFormat;
    8 import java.util.logging.Logger;
    99
    1010import org.openstreetmap.josm.data.projection.Projections;
     
    1212import org.openstreetmap.josm.tools.I18n;
    1313
     14/**
     15 * Fixture to define a proper and safe environment before running tests.
     16 */
    1417public class JOSMFixture {
    15     static private final Logger logger = Logger.getLogger(JOSMFixture.class.getName());
    1618
     19    /**
     20     * Returns a new test fixture initialized to "unit" home.
     21     * @return A new test fixture for unit tests
     22     */
    1723    static public JOSMFixture createUnitTestFixture() {
    1824        return new JOSMFixture("test/config/unit-josm.home");
    1925    }
    2026
     27    /**
     28     * Returns a new test fixture initialized to "functional" home.
     29     * @return A new test fixture for functional tests
     30     */
    2131    static public JOSMFixture createFunctionalTestFixture() {
    2232        return new JOSMFixture("test/config/functional-josm.home");
    2333    }
    2434
     35    /**
     36     * Returns a new test fixture initialized to "performance" home.
     37     * @return A new test fixture for performance tests
     38     */
    2539    static public JOSMFixture createPerformanceTestFixture() {
    2640        return new JOSMFixture("test/config/performance-josm.home");
     
    2943    private final String josmHome;
    3044
     45    /**
     46     * Constructs a new text fixture initialized to a given josm home.
     47     * @param josmHome The user home where preferences are to be read/written
     48     */
    3149    public JOSMFixture(String josmHome) {
    3250        this.josmHome = josmHome;
    3351    }
    3452
     53    /**
     54     * Initializes the test fixture.
     55     */
    3556    public void init() {
    3657
     
    4263            File f = new File(josmHome);
    4364            if (! f.exists() || ! f.canRead()) {
    44                 fail(MessageFormat.format("property ''{0}'' points to ''{1}'' which is either not existing or not readable.", "josm.home", josmHome));
     65                fail(MessageFormat.format("property ''{0}'' points to ''{1}'' which is either not existing ({2}) or not readable ({3}). Current directory is ''{4}''.",
     66                        "josm.home", josmHome, f.exists(), f.canRead(), Paths.get("").toAbsolutePath()));
    4567            }
    4668        }
Note: See TracChangeset for help on using the changeset viewer.