From 6011d566cf2f64f531e828553a5bec3baab0b2a2 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 2 May 2021 17:14:56 +0200 Subject: [PATCH] [geoloc] Do not use Time IQ for timezone operations --- .../smackx/geoloc/packet/GeoLocationTest.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/packet/GeoLocationTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/packet/GeoLocationTest.java index 60003cb36..016d414ea 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/packet/GeoLocationTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/packet/GeoLocationTest.java @@ -27,8 +27,6 @@ import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.util.PacketParserUtils; -import org.jivesoftware.smackx.time.packet.Time; - import org.junit.jupiter.api.Test; import org.jxmpp.util.XmppDateTime; @@ -44,9 +42,11 @@ public class GeoLocationTest extends SmackTestSuite { Calendar calendar = Calendar.getInstance(); calendar.setTimeZone(TimeZone.getTimeZone("GMT-830")); - Time time = new Time(calendar); + String tzo = XmppDateTime.asString(calendar.getTimeZone()); - GeoLocation geoLocation = new GeoLocation.Builder().setTzo(time.getTzo()).build(); + GeoLocation geoLocation = GeoLocation.builder() + .setTzo(tzo) + .build(); assertEquals("-8:30", geoLocation.getTzo()); } @@ -56,9 +56,11 @@ public class GeoLocationTest extends SmackTestSuite { Calendar calendar = Calendar.getInstance(); calendar.setTimeZone(TimeZone.getTimeZone("GMT+530")); - Time time = new Time(calendar); + String tzo = XmppDateTime.asString(calendar.getTimeZone()); - GeoLocation geoLocation = new GeoLocation.Builder().setTzo(time.getTzo()).build(); + GeoLocation geoLocation = GeoLocation.builder() + .setTzo(tzo) + .build(); assertEquals("+5:30", geoLocation.getTzo()); @@ -67,7 +69,7 @@ public class GeoLocationTest extends SmackTestSuite { @Test public void accuracyTest() { - GeoLocation geoLocation = new GeoLocation.Builder().setAccuracy(1.34d).build(); + GeoLocation geoLocation = GeoLocation.builder().setAccuracy(1.34d).build(); assertEquals((Double) 1.34, geoLocation.getAccuracy()); } @@ -75,7 +77,7 @@ public class GeoLocationTest extends SmackTestSuite { @Test public void altAccuracyTest() { - GeoLocation geoLocation = new GeoLocation.Builder().setAltAccuracy(1.52d).build(); + GeoLocation geoLocation = GeoLocation.builder().setAltAccuracy(1.52d).build(); assertEquals((Double) 1.52, geoLocation.getAltAccuracy()); }