Ticket #13048: patch-test-ExceptionUtilTest-timezone.patch

File patch-test-ExceptionUtilTest-timezone.patch, 1.9 KB (added by michael2402, 6 years ago)
  • test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java

    diff --git a/test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java b/test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java
    index f75af6a..15c382c 100644
    a b import java.net.HttpURLConnection; 
    88import java.net.SocketException;
    99import java.net.URL;
    1010import java.net.UnknownHostException;
     11import java.util.TimeZone;
    1112
    1213import org.junit.BeforeClass;
    1314import org.junit.Test;
    import org.openstreetmap.josm.io.OsmApiException; 
    2122import org.openstreetmap.josm.io.OsmApiInitializationException;
    2223import org.openstreetmap.josm.io.auth.CredentialsManager;
    2324import org.openstreetmap.josm.tools.date.DateUtils;
     25import org.openstreetmap.josm.tools.date.DateUtilsTest;
    2426
    2527/**
    2628 * Unit tests of {@link ExceptionUtil} class.
    public class ExceptionUtilTest { 
    123125                ExceptionUtil.explainConflict(new OsmApiException(code, "header", "")));
    124126        assertEquals("<html>Closing of changeset <strong>1</strong> failed <br>because it has already been closed.",
    125127                ExceptionUtil.explainConflict(new OsmApiException(code, "The changeset 1 was closed at xxx", "")));
     128        assertEquals("<html>Closing of changeset <strong>1</strong> failed<br> because it has already been closed on 2016-01-01 12:34:56.",
     129                ExceptionUtil.explainConflict(new OsmApiException(code, "The changeset 1 was closed at 2016-01-01 12:34:56 UTC", "")));
     130        DateUtilsTest.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
     131        TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
    126132        assertEquals("<html>Closing of changeset <strong>1</strong> failed<br> because it has already been closed on 2016-01-01 13:34:56.",
    127133                ExceptionUtil.explainConflict(new OsmApiException(code, "The changeset 1 was closed at 2016-01-01 12:34:56 UTC", "")));
    128134    }