]> git.basschouten.com Git - openhab-addons.git/blob
55d0a3339825d811cfc24ba57aa5ff8efca85ddc
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.automation.jsscriptingnashorn;
14
15 import static org.hamcrest.CoreMatchers.is;
16 import static org.hamcrest.MatcherAssert.assertThat;
17 import static org.hamcrest.Matchers.contains;
18
19 import java.util.List;
20
21 import org.eclipse.jdt.annotation.NonNullByDefault;
22 import org.junit.jupiter.api.Test;
23 import org.openhab.automation.jsscriptingnashorn.internal.NashornScriptEngineFactory;
24
25 /**
26  * Tests {@link NashornScriptEngineFactory}.
27  *
28  * @author Wouter Born - Initial contribution
29  */
30 @NonNullByDefault
31 public class NashornScriptEngineFactoryTest {
32
33     @Test
34     public void scriptTypesAreNashornSpecific() {
35         List<String> scriptTypes = new NashornScriptEngineFactory().getScriptTypes();
36
37         assertThat(scriptTypes,
38                 contains("nashornjs", "application/javascript;version=ECMAScript-5.1",
39                         "application/ecmascript;version=ECMAScript-5.1", "text/javascript;version=ECMAScript-5.1",
40                         "text/ecmascript;version=ECMAScript-5.1"));
41         assertThat(scriptTypes.size(), is(5));
42     }
43 }