2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.enturno.internal.util;
15 import static org.hamcrest.CoreMatchers.*;
16 import static org.hamcrest.MatcherAssert.assertThat;
18 import java.util.stream.Stream;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.junit.jupiter.params.ParameterizedTest;
22 import org.junit.jupiter.params.provider.Arguments;
23 import org.junit.jupiter.params.provider.MethodSource;
26 * Tests for {@link DateUtil}.
28 * @author Jacob Laursen - Initial contribution
31 public class DateUtilTest {
33 @MethodSource("provideTestCasesForGetIsoDateTime")
34 void getIsoDateTime(String value, String expected) {
35 assertThat(DateUtil.getIsoDateTime(value), is(expected));
38 private static Stream<Arguments> provideTestCasesForGetIsoDateTime() {
40 Arguments.of("2023-10-25T09:01:00+0200", "2023-10-25T09:01:00+02:00"),
41 Arguments.of("2023-10-25T09:01:00+02:00", "2023-10-25T09:01:00+02:00"),
42 Arguments.of("2023-10-25T09:01:00-0300", "2023-10-25T09:01:00-03:00"),
43 Arguments.of("2023-10-25T09:01:00+02:30", "2023-10-25T09:01:00+02:30"),
44 Arguments.of("2023-10-25T09:01:00", "2023-10-25T09:01:00"));