Ignore:
Timestamp:
2020-10-28T20:41:00+01:00 (5 years ago)
Author:
Don-vip
Message:

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

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

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/preferences/JosmUrlsTest.java

    r14119 r17275  
    22package org.openstreetmap.josm.data.preferences;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.spi.preferences.Config;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests of {@link JosmUrls} class.
    1515 */
    16 public class JosmUrlsTest {
     16class JosmUrlsTest {
    1717
    1818    /**
    1919     * Setup test.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules().devAPI();
     
    2727     */
    2828    @Test
    29     public void testGetBaseUserUrl() {
     29    void testGetBaseUserUrl() {
    3030        assertEquals("https://api06.dev.openstreetmap.org/user", Config.getUrls().getBaseUserUrl());
    3131    }
  • trunk/test/unit/org/openstreetmap/josm/data/preferences/NamedColorPropertyTest.java

    r17119 r17275  
    22package org.openstreetmap.josm.data.preferences;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.awt.Color;
     
    1111import javax.swing.UIManager;
    1212
    13 import org.junit.Before;
    14 import org.junit.Rule;
    15 import org.junit.Test;
     13import org.junit.jupiter.api.BeforeEach;
     14import org.junit.jupiter.api.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
    1616import org.openstreetmap.josm.data.Preferences;
    1717import org.openstreetmap.josm.spi.preferences.Config;
     
    2424 * @author Michael Zangl
    2525 */
    26 public class NamedColorPropertyTest {
     26class NamedColorPropertyTest {
    2727    /**
    2828     * This is a preference test.
    2929     */
    30     @Rule
     30    @RegisterExtension
    3131    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3232    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3636     * Set up test case
    3737     */
    38     @Before
     38    @BeforeEach
    3939    public void createTestProperty() {
    4040        base = new NamedColorProperty("test", Color.RED);
     
    4545     */
    4646    @Test
    47     public void testGet() {
     47    void testGet() {
    4848        assertEquals(Color.RED, base.get());
    4949
     
    6565     */
    6666    @Test
    67     public void testPut() {
     67    void testPut() {
    6868        assertEquals(Color.RED, base.get());
    6969
     
    8080     */
    8181    @Test
    82     public void testColorAlpha() {
     82    void testColorAlpha() {
    8383        assertEquals(0x12, new NamedColorProperty("foo", new Color(0x12345678, true)).get().getAlpha());
    8484        assertTrue(Preferences.main().putList("clr.general.bar", Arrays.asList("#34567812", "general", "", "bar")));
     
    9090     */
    9191    @Test
    92     public void testColorNameAlpha() {
     92    void testColorNameAlpha() {
    9393        assertEquals(0x12, new NamedColorProperty("foo", new Color(0x12345678, true)).get().getAlpha());
    9494    }
     
    9898     */
    9999    @Test
    100     public void testGetChildColor() {
     100    void testGetChildColor() {
    101101        AbstractProperty<Color> child = base.getChildColor("test2");
    102102
  • trunk/test/unit/org/openstreetmap/josm/data/preferences/PreferencesWriterTest.java

    r12884 r17275  
    22package org.openstreetmap.josm.data.preferences;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.IOException;
     
    1313import java.util.TreeMap;
    1414
    15 import org.junit.Test;
     15import org.junit.jupiter.api.Test;
    1616import org.openstreetmap.josm.data.Version;
    1717import org.openstreetmap.josm.spi.preferences.Setting;
     
    2525 * Unit tests for class {@link PreferencesWriter}.
    2626 */
    27 public class PreferencesWriterTest {
     27class PreferencesWriterTest {
    2828
    2929    private static <T extends AbstractSetting<?>> T setting(T s, long time) {
     
    3737     */
    3838    @Test
    39     public void testListList() throws IOException {
     39    void testListList() throws IOException {
    4040        try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) {
    4141            long time = System.currentTimeMillis() / 1000;
     
    5656     */
    5757    @Test
    58     public void testList() throws IOException {
     58    void testList() throws IOException {
    5959        try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) {
    6060            long time = System.currentTimeMillis() / 1000;
     
    7373     */
    7474    @Test
    75     public void testMapList() throws IOException {
     75    void testMapList() throws IOException {
    7676        try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) {
    7777            long time = System.currentTimeMillis() / 1000;
     
    9494     */
    9595    @Test
    96     public void testString() throws IOException {
     96    void testString() throws IOException {
    9797        try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) {
    9898            long time = System.currentTimeMillis() / 1000;
     
    109109     */
    110110    @Test
    111     public void testWrite() throws IOException {
     111    void testWrite() throws IOException {
    112112        try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) {
    113113            long time = System.currentTimeMillis() / 1000;
     
    132132     */
    133133    @Test
    134     public void testNullValue() throws IOException {
     134    void testNullValue() throws IOException {
    135135        long time = System.currentTimeMillis() / 1000;
    136136        // CHECKSTYLE.OFF: LineLength
  • trunk/test/unit/org/openstreetmap/josm/data/preferences/StrokePropertyTest.java

    r15775 r17275  
    22package org.openstreetmap.josm.data.preferences;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
    66
    77import java.awt.BasicStroke;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.spi.preferences.Config;
    1212import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1818 * @author Michael Zangl
    1919 */
    20 public class StrokePropertyTest {
     20class StrokePropertyTest {
    2121    /**
    2222     * This is a preference test
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3030     */
    3131    @Test
    32     public void testGetValue() {
     32    void testGetValue() {
    3333        StrokeProperty property = new StrokeProperty("x", "1");
    3434
     
    7575     */
    7676    @Test
    77     public void testPutValue() {
     77    void testPutValue() {
    7878        StrokeProperty property = new StrokeProperty("x", new BasicStroke(12));
    7979        BasicStroke bs = property.get();
Note: See TracChangeset for help on using the changeset viewer.