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.livisismarthome.internal.client;
15 import static org.junit.jupiter.api.Assertions.assertEquals;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.junit.jupiter.api.Test;
21 * @author Sven Strohschein - Initial contribution
24 public class URLCreatorTest {
27 public void testCreateEventsURL() {
28 String url = URLCreator.createEventsURL("localhost", "token+123/456", false);
29 // The token should be URL encoded
30 assertEquals("ws://localhost:9090/events?token=token%2B123%2F456", url);
34 public void testCreateEventsURLClassicController() {
35 String url = URLCreator.createEventsURL("localhost", "token123", true);
36 assertEquals("ws://localhost:8080/events?token=token123", url);
40 public void testCreateEventsURLGen2Controller() {
41 String url = URLCreator.createEventsURL("localhost", "token123", false);
42 assertEquals("ws://localhost:9090/events?token=token123", url);