1 /*
2 * Copyright (c) 2002-2025 Gargoyle Software Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * https://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 package org.htmlunit.libraries;
16
17 import java.net.URL;
18
19 import org.eclipse.jetty.server.Server;
20 import org.htmlunit.WebDriverTestCase;
21 import org.htmlunit.WebServerTestCase;
22 import org.junit.jupiter.api.AfterAll;
23 import org.junit.jupiter.api.BeforeAll;
24 import org.junit.jupiter.api.Test;
25 import org.openqa.selenium.WebDriver;
26
27 /**
28 * Tests for compatibility with <a href="http://www.curvycorners.net">curvyCorners</a>.
29 *
30 * @author Gareth Davis
31 * @author Ronald Brill
32 */
33 public class CurvyCornersTest extends WebDriverTestCase {
34
35 /** The server. */
36 protected static Server SERVER_;
37
38 /**
39 * @throws Exception if an error occurs
40 */
41 @BeforeAll
42 public static void startSesrver() throws Exception {
43 SERVER_ = WebServerTestCase.createWebServer("src/test/resources/libraries/curvyCorners/1.2.9-beta/", null);
44 }
45
46 /**
47 * @throws Exception if an error occurs
48 */
49 @AfterAll
50 public static void stopServer() throws Exception {
51 if (SERVER_ != null) {
52 SERVER_.stop();
53 SERVER_.destroy();
54 SERVER_ = null;
55 }
56 }
57
58 /**
59 * @return the resource base URL
60 */
61 protected URL getBaseUrl() {
62 return URL_FIRST;
63 }
64
65 /**
66 * @throws Exception if the test fails
67 */
68 @Test
69 public void demo() throws Exception {
70 doTest("demo.html");
71 }
72
73 /**
74 * @throws Exception if the test fails
75 */
76 @Test
77 public void demo2() throws Exception {
78 doTest("demo2.html");
79 }
80
81 private void doTest(final String filename) throws Exception {
82 final WebDriver driver = getWebDriver();
83 driver.get(getBaseUrl() + filename);
84 }
85 }