Changeset 9498 in josm


Ignore:
Timestamp:
2016-01-17T05:29:59+01:00 (8 years ago)
Author:
Don-vip
Message:

add unit tests, code cleanup

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r9402 r9498  
    6464public final class CustomConfigurator {
    6565
     66    private static StringBuilder summary = new StringBuilder();
     67
    6668    private CustomConfigurator() {
    6769        // Hide default constructor for utils classes
    6870    }
    6971
    70     private static StringBuilder summary = new StringBuilder();
    71 
     72    /**
     73     * Log a formatted message.
     74     * @param fmt format
     75     * @param vars arguments
     76     * @see String#format
     77     */
    7278    public static void log(String fmt, Object... vars) {
    7379        summary.append(String.format(fmt, vars));
    7480    }
    7581
     82    /**
     83     * Log a message.
     84     * @param s message to log
     85     */
    7686    public static void log(String s) {
    7787        summary.append(s);
     
    7989    }
    8090
     91    /**
     92     * Returns the log.
     93     * @return the log
     94     */
    8195    public static String getLog() {
    8296        return summary.toString();
     
    122136
    123137    /**
    124      * Downloads file to one of JOSM standard folders nad unpack it as ZIP/JAR file
     138     * Downloads file to one of JOSM standard folders and unpack it as ZIP/JAR file
    125139     * @param address - URL to download
    126140     * @param path - file path relative to base where to put downloaded file
     
    223237        Map<String, Setting<?>> allSettings = Main.pref.getAllSettings();
    224238        for (String key: allSettings.keySet()) {
    225             if (key.matches(pattern)) keySet.add(key);
     239            if (key.matches(pattern))
     240                keySet.add(key);
    226241        }
    227242        exportPreferencesKeysToFile(fileName, append, keySet);
     
    253268            Main.warn("Error getting preferences to save:" +ex.getMessage());
    254269        }
    255         if (root == null) return;
     270        if (root == null)
     271            return;
    256272        try {
    257 
    258273            Element newRoot = exportDocument.createElement("config");
    259274            exportDocument.appendChild(newRoot);
     
    459474            try {
    460475                this.mainPrefs = mainPrefs;
    461                 CustomConfigurator.summary = new StringBuilder();
     476                summary = new StringBuilder();
    462477                engine = new ScriptEngineManager().getEngineByName("rhino");
    463478                engine.eval("API={}; API.pref={}; API.fragments={};");
     
    482497
    483498        private void processXML(Document document) {
    484             Element root = document.getDocumentElement();
    485             processXmlFragment(root);
     499            processXmlFragment(document.getDocumentElement());
    486500        }
    487501
     
    10271041
    10281042        for (Entry<String, List<Collection<String>>> e : listlistMap.entrySet()) {
    1029             @SuppressWarnings("unchecked")
     1043            @SuppressWarnings({ "unchecked", "rawtypes" })
    10301044            List<List<String>> value = (List) e.getValue();
    10311045            tmp.put(e.getKey(), new ListListSetting(value));
     
    11491163            "}\n";
    11501164
    1151         // Execute conversion script
    1152         engine.eval(init);
    1153     }
     1165            // Execute conversion script
     1166            engine.eval(init);
     1167        }
    11541168    }
    11551169}
  • trunk/test/unit/org/openstreetmap/josm/data/BoundsTest.java

    r9214 r9498  
    99import org.openstreetmap.josm.data.coor.LatLon;
    1010
     11/**
     12 * Unit tests for class {@link Bounds}.
     13 */
    1114public class BoundsTest {
    1215
  • trunk/test/unit/org/openstreetmap/josm/data/projection/EllipsoidTest.java

    r8510 r9498  
    88import org.openstreetmap.josm.data.coor.LatLon;
    99
     10/**
     11 * Unit tests for class {@link Ellipsoid}.
     12 */
    1013public class EllipsoidTest {
    1114
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java

    r9372 r9498  
    1313import org.openstreetmap.josm.data.coor.LatLon;
    1414
     15/**
     16 * Unit tests for class {@link Projection}.
     17 */
    1518public class ProjectionTest {
    1619
Note: See TracChangeset for help on using the changeset viewer.