Ignore:
Timestamp:
2016-04-03T15:42:30+02:00 (9 years ago)
Author:
Don-vip
Message:

add more 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/help/HelpBrowserTest.java

    r9669 r10103  
    1515public class HelpBrowserTest {
    1616
    17     private static final String URL_1 = "https://josm.openstreetmap.de/wiki/Help";
    18     private static final String URL_2 = "https://josm.openstreetmap.de/wiki/Introduction";
    19     private static final String URL_3 = "https://josm.openstreetmap.de/javadoc";
     17    static final String URL_1 = "https://josm.openstreetmap.de/wiki/Help";
     18    static final String URL_2 = "https://josm.openstreetmap.de/wiki/Introduction";
     19    static final String URL_3 = "https://josm.openstreetmap.de/javadoc";
    2020
    2121    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/audio/AudioPreferenceTest.java

    r9973 r10103  
    77import org.junit.Test;
    88import org.openstreetmap.josm.JOSMFixture;
     9import org.openstreetmap.josm.Main;
    910import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
    1011
     
    3536    @Test
    3637    public void testAddGui() {
     38        Main.pref.put("audio.menuinvisible", true);
     39        PreferencesTestUtils.doTestPreferenceSettingAddGui(new AudioPreference.Factory(), null);
     40        Main.pref.put("audio.menuinvisible", false);
    3741        PreferencesTestUtils.doTestPreferenceSettingAddGui(new AudioPreference.Factory(), null);
    3842    }
  • trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java

    r9739 r10103  
    44import static org.junit.Assert.assertEquals;
    55
     6import java.text.DateFormat;
    67import java.util.Date;
    78import java.util.TimeZone;
    89
     10import org.junit.BeforeClass;
    911import org.junit.Test;
     12import org.openstreetmap.josm.JOSMFixture;
    1013import org.openstreetmap.josm.tools.UncheckedParseException;
    1114
     
    1417 */
    1518public class DateUtilsTest {
     19
     20    /**
     21     * Setup test.
     22     */
     23    @BeforeClass
     24    public static void setUp() {
     25        JOSMFixture.createUnitTestFixture().init();
     26    }
    1627
    1728    /**
     
    8697        assertEquals(1453694709400L, DateUtils.fromString("2016-01-25T04:05:09.400Z").getTime());
    8798    }
     99
     100    /**
     101     * Unit test of {@link DateUtils#fromTimestamp} method.
     102     */
     103    @Test
     104    public void testFromTimestamp() {
     105        assertEquals("1970-01-01T00:00:00Z", DateUtils.fromTimestamp(0));
     106        assertEquals("2001-09-09T01:46:40Z", DateUtils.fromTimestamp(1000000000));
     107        assertEquals("2038-01-19T03:14:07Z", DateUtils.fromTimestamp(Integer.MAX_VALUE));
     108    }
     109
     110    /**
     111     * Unit test of {@link DateUtils#formatTime} method.
     112     */
     113    @Test
     114    public void testFormatTime() {
     115        assertEquals("1:00 AM", DateUtils.formatTime(new Date(123), DateFormat.SHORT));
     116        assertEquals("1:00:00 AM CET", DateUtils.formatTime(new Date(123), DateFormat.LONG));
     117    }
    88118}
Note: See TracChangeset for help on using the changeset viewer.