From ab5ebbc41b0429ef05b57c486144803ad08d14b9 Mon Sep 17 00:00:00 2001 From: lsiepel Date: Fri, 27 Oct 2023 20:52:54 +0200 Subject: [PATCH] [enturno] Remove org.apache.commons (#14406) * Remove org.apache.commons * Fix warnings Also-by: Jacob Laursen Signed-off-by: Leo Siepel --- .../enturno/internal/EnturNoHandler.java | 2 +- .../connection/EnturNoConnection.java | 29 ++++------- .../enturno/internal/{model => dto}/Data.java | 4 +- .../internal/{model => dto}/EnturData.java | 2 +- .../{model => dto}/EnturJsonData.java | 2 +- .../estimated/DestinationDisplay.java | 2 +- .../estimated/EstimatedCalls.java | 2 +- .../estimated/JourneyPattern.java | 2 +- .../{model => dto}/estimated/Line.java | 2 +- .../{model => dto}/estimated/Quay.java | 2 +- .../estimated/ServiceJourney.java | 2 +- .../simplified/DisplayData.java | 2 +- .../{model => dto}/stopplace/StopPlace.java | 4 +- .../enturno/internal/util/DateUtil.java | 51 +++++++++++++++++++ .../enturno/internal/util/DateUtilTest.java | 46 +++++++++++++++++ 15 files changed, 120 insertions(+), 34 deletions(-) rename bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/{model => dto}/Data.java (82%) rename bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/{model => dto}/EnturData.java (91%) rename bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/{model => dto}/EnturJsonData.java (91%) rename bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/{model => dto}/estimated/DestinationDisplay.java (90%) rename bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/{model => dto}/estimated/EstimatedCalls.java (93%) rename bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/{model => dto}/estimated/JourneyPattern.java (90%) rename bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/{model => dto}/estimated/Line.java (91%) rename bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/{model => dto}/estimated/Quay.java (90%) rename bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/{model => dto}/estimated/ServiceJourney.java (90%) rename bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/{model => dto}/simplified/DisplayData.java (93%) rename bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/{model => dto}/stopplace/StopPlace.java (83%) create mode 100644 bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/util/DateUtil.java create mode 100644 bundles/org.openhab.binding.enturno/src/test/java/org/openhab/binding/enturno/internal/util/DateUtilTest.java diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/EnturNoHandler.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/EnturNoHandler.java index a89e5bcef..853f25fa8 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/EnturNoHandler.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/EnturNoHandler.java @@ -26,7 +26,7 @@ import org.eclipse.jetty.client.HttpClient; import org.openhab.binding.enturno.internal.connection.EnturCommunicationException; import org.openhab.binding.enturno.internal.connection.EnturConfigurationException; import org.openhab.binding.enturno.internal.connection.EnturNoConnection; -import org.openhab.binding.enturno.internal.model.simplified.DisplayData; +import org.openhab.binding.enturno.internal.dto.simplified.DisplayData; import org.openhab.core.library.types.DateTimeType; import org.openhab.core.library.types.StringType; import org.openhab.core.thing.Channel; diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/connection/EnturNoConnection.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/connection/EnturNoConnection.java index 8d9b01fe5..6ed517a60 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/connection/EnturNoConnection.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/connection/EnturNoConnection.java @@ -32,7 +32,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; -import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jetty.client.HttpClient; @@ -42,10 +41,11 @@ import org.eclipse.jetty.client.util.StringContentProvider; import org.eclipse.jetty.http.HttpHeader; import org.openhab.binding.enturno.internal.EnturNoConfiguration; import org.openhab.binding.enturno.internal.EnturNoHandler; -import org.openhab.binding.enturno.internal.model.EnturJsonData; -import org.openhab.binding.enturno.internal.model.estimated.EstimatedCalls; -import org.openhab.binding.enturno.internal.model.simplified.DisplayData; -import org.openhab.binding.enturno.internal.model.stopplace.StopPlace; +import org.openhab.binding.enturno.internal.dto.EnturJsonData; +import org.openhab.binding.enturno.internal.dto.estimated.EstimatedCalls; +import org.openhab.binding.enturno.internal.dto.simplified.DisplayData; +import org.openhab.binding.enturno.internal.dto.stopplace.StopPlace; +import org.openhab.binding.enturno.internal.util.DateUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -189,10 +189,8 @@ public class EnturNoConnection { } private List processData(StopPlace stopPlace, String lineCode) { - Map> departures = stopPlace.estimatedCalls.stream() - .filter(call -> StringUtils.equalsIgnoreCase( - StringUtils.trimToEmpty(call.serviceJourney.journeyPattern.line.publicCode), - StringUtils.trimToEmpty(lineCode))) + Map> departures = stopPlace.estimatedCalls.stream().filter( + call -> call.serviceJourney.journeyPattern.line.publicCode.strip().equalsIgnoreCase(lineCode.strip())) .collect(groupingBy(call -> call.quay.id)); List processedData = new ArrayList<>(); @@ -214,8 +212,8 @@ public class EnturNoConnection { List keys = new ArrayList<>(departures.keySet()); DisplayData processedData = new DisplayData(); List quayCalls = departures.get(keys.get(quayIndex)); - List departureTimes = quayCalls.stream().map(eq -> eq.expectedDepartureTime).map(this::getIsoDateTime) - .collect(Collectors.toList()); + List departureTimes = quayCalls.stream().map(eq -> eq.expectedDepartureTime) + .map(DateUtil::getIsoDateTime).collect(Collectors.toList()); List estimatedFlags = quayCalls.stream().map(es -> es.realtime).collect(Collectors.toList()); @@ -233,13 +231,4 @@ public class EnturNoConnection { processedData.transportMode = stopPlace.transportMode; return processedData; } - - private String getIsoDateTime(String dateTimeWithoutColonInZone) { - String dateTime = StringUtils.substringBeforeLast(dateTimeWithoutColonInZone, "+"); - String offset = StringUtils.substringAfterLast(dateTimeWithoutColonInZone, "+"); - - StringBuilder builder = new StringBuilder(); - return builder.append(dateTime).append("+").append(StringUtils.substring(offset, 0, 2)).append(":00") - .toString(); - } } diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/Data.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/Data.java similarity index 82% rename from bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/Data.java rename to bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/Data.java index f17de89a6..c6a37b9b8 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/Data.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/Data.java @@ -10,9 +10,9 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.enturno.internal.model; +package org.openhab.binding.enturno.internal.dto; -import org.openhab.binding.enturno.internal.model.stopplace.StopPlace; +import org.openhab.binding.enturno.internal.dto.stopplace.StopPlace; /** * Generated Plain Old Java Objects class for {@link Data} from JSON. diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/EnturData.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/EnturData.java similarity index 91% rename from bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/EnturData.java rename to bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/EnturData.java index b6d5db3bf..04293d790 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/EnturData.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/EnturData.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.enturno.internal.model; +package org.openhab.binding.enturno.internal.dto; /** * Generated Plain Old Java Objects class for {@link Data} from JSON. diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/EnturJsonData.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/EnturJsonData.java similarity index 91% rename from bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/EnturJsonData.java rename to bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/EnturJsonData.java index 446a5ce1a..f175af3fc 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/EnturJsonData.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/EnturJsonData.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.enturno.internal.model; +package org.openhab.binding.enturno.internal.dto; /** * {@link EnturJsonData} is a root level class to holding reference of data generated from JSON. diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/DestinationDisplay.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/DestinationDisplay.java similarity index 90% rename from bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/DestinationDisplay.java rename to bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/DestinationDisplay.java index d16d3c30a..4818da524 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/DestinationDisplay.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/DestinationDisplay.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.enturno.internal.model.estimated; +package org.openhab.binding.enturno.internal.dto.estimated; /** * Generated Plain Old Java Objects class for {@link DestinationDisplay} from JSON. diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/EstimatedCalls.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/EstimatedCalls.java similarity index 93% rename from bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/EstimatedCalls.java rename to bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/EstimatedCalls.java index 52f51a7bf..c3a056c05 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/EstimatedCalls.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/EstimatedCalls.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.enturno.internal.model.estimated; +package org.openhab.binding.enturno.internal.dto.estimated; /** * Generated Plain Old Java Objects class for {@link EstimatedCalls} from JSON. diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/JourneyPattern.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/JourneyPattern.java similarity index 90% rename from bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/JourneyPattern.java rename to bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/JourneyPattern.java index 39bbcd533..e5ba379f3 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/JourneyPattern.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/JourneyPattern.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.enturno.internal.model.estimated; +package org.openhab.binding.enturno.internal.dto.estimated; /** * Generated Plain Old Java Objects class for {@link JourneyPattern} from JSON. diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/Line.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/Line.java similarity index 91% rename from bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/Line.java rename to bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/Line.java index 068d06655..db43d2ea0 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/Line.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/Line.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.enturno.internal.model.estimated; +package org.openhab.binding.enturno.internal.dto.estimated; /** * Generated Plain Old Java Objects class for {@link Line} from JSON. diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/Quay.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/Quay.java similarity index 90% rename from bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/Quay.java rename to bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/Quay.java index 114072440..310ff8e32 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/Quay.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/Quay.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.enturno.internal.model.estimated; +package org.openhab.binding.enturno.internal.dto.estimated; /** * Generated Plain Old Java Objects class for {@link Quay} from JSON. diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/ServiceJourney.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/ServiceJourney.java similarity index 90% rename from bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/ServiceJourney.java rename to bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/ServiceJourney.java index 7b7dbb969..e5f35fdc7 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/estimated/ServiceJourney.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/estimated/ServiceJourney.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.enturno.internal.model.estimated; +package org.openhab.binding.enturno.internal.dto.estimated; /** * Generated Plain Old Java Objects class for {@link ServiceJourney} from JSON. diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/simplified/DisplayData.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/simplified/DisplayData.java similarity index 93% rename from bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/simplified/DisplayData.java rename to bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/simplified/DisplayData.java index bf210c3dc..2ed9afd13 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/simplified/DisplayData.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/simplified/DisplayData.java @@ -10,7 +10,7 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.enturno.internal.model.simplified; +package org.openhab.binding.enturno.internal.dto.simplified; import java.util.List; diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/stopplace/StopPlace.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/stopplace/StopPlace.java similarity index 83% rename from bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/stopplace/StopPlace.java rename to bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/stopplace/StopPlace.java index 0f0492ae3..7881e29a1 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/model/stopplace/StopPlace.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/dto/stopplace/StopPlace.java @@ -10,9 +10,9 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.binding.enturno.internal.model.stopplace; +package org.openhab.binding.enturno.internal.dto.stopplace; -import org.openhab.binding.enturno.internal.model.estimated.EstimatedCalls; +import org.openhab.binding.enturno.internal.dto.estimated.EstimatedCalls; /** * Generated Plain Old Java Objects class for {@link StopPlace} from JSON. diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/util/DateUtil.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/util/DateUtil.java new file mode 100644 index 000000000..4f1be6312 --- /dev/null +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/util/DateUtil.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.enturno.internal.util; + +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * EnturNo date utility methods. + * + * @author Jacob Laursen - Initial contribution + */ +@NonNullByDefault +public class DateUtil { + /** + * Converts a zoned date time string that lacks a colon in the zone to an ISO-8601 formatted string. + * + * @param dateTimeWithoutColonInZone + * @return ISO-8601 formatted string + */ + public static String getIsoDateTime(String dateTimeWithoutColonInZone) { + ZonedDateTime zonedDateTime = null; + try { + zonedDateTime = ZonedDateTime.parse(dateTimeWithoutColonInZone); + } catch (DateTimeParseException e) { + // Skip + } + try { + zonedDateTime = ZonedDateTime.parse(dateTimeWithoutColonInZone.replaceAll("(\\d{2})(\\d{2})$", "$1:$2")); + } catch (DateTimeParseException e) { + // Skip + } + if (zonedDateTime != null) { + return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(zonedDateTime); + } + return dateTimeWithoutColonInZone; + } +} diff --git a/bundles/org.openhab.binding.enturno/src/test/java/org/openhab/binding/enturno/internal/util/DateUtilTest.java b/bundles/org.openhab.binding.enturno/src/test/java/org/openhab/binding/enturno/internal/util/DateUtilTest.java new file mode 100644 index 000000000..c9ac27df9 --- /dev/null +++ b/bundles/org.openhab.binding.enturno/src/test/java/org/openhab/binding/enturno/internal/util/DateUtilTest.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.enturno.internal.util; + +import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.stream.Stream; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +/** + * Tests for {@link DateUtil}. + * + * @author Jacob Laursen - Initial contribution + */ +@NonNullByDefault +public class DateUtilTest { + @ParameterizedTest + @MethodSource("provideTestCasesForGetIsoDateTime") + void getIsoDateTime(String value, String expected) { + assertThat(DateUtil.getIsoDateTime(value), is(expected)); + } + + private static Stream provideTestCasesForGetIsoDateTime() { + return Stream.of( // + Arguments.of("2023-10-25T09:01:00+0200", "2023-10-25T09:01:00+02:00"), + Arguments.of("2023-10-25T09:01:00+02:00", "2023-10-25T09:01:00+02:00"), + Arguments.of("2023-10-25T09:01:00-0300", "2023-10-25T09:01:00-03:00"), + Arguments.of("2023-10-25T09:01:00+02:30", "2023-10-25T09:01:00+02:30"), + Arguments.of("2023-10-25T09:01:00", "2023-10-25T09:01:00")); + } +}