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 java.org.openhab.binding.vesync.internal.handler.requests;
15 import static org.junit.jupiter.api.Assertions.assertEquals;
17 import java.util.regex.Matcher;
18 import java.util.regex.Pattern;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.junit.Test;
22 import org.openhab.binding.vesync.internal.VeSyncConstants;
23 import org.openhab.binding.vesync.internal.dto.requests.VesyncRequest;
26 * The {@link VesyncRequestTest} class implements unit test case for {@link VesyncRequest}
28 * @author David Goodyear - Initial contribution
31 public class VesyncRequestTest {
34 public void checkBaseFieldsExist() {
35 String content = VeSyncConstants.GSON.toJson(new VesyncRequest());
37 assertEquals(true, content.contains("\"timeZone\": \"America/New_York\""));
38 assertEquals(true, content.contains("\"acceptLanguage\": \"en\""));
40 assertEquals(true, content.contains("\"appVersion\": \"2.5.1\""));
41 assertEquals(true, content.contains("\"phoneBrand\": \"SM N9005\""));
42 assertEquals(true, content.contains("\"phoneOS\": \"Android\""));
44 Pattern p = Pattern.compile("\"traceId\": \"\\d+\"");
45 Matcher m = p.matcher(content);
46 assertEquals(true, m.find());