Skip to content

Commit a1e4904

Browse files
committed
JVM/JS tests for GWT class itself
1 parent b4550fc commit a1e4904

File tree

5 files changed

+104
-6
lines changed

5 files changed

+104
-6
lines changed

gwt-core-gwt2-tests/src/test/java/org/gwtproject/core/CoreSuite.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,15 @@
1717

1818
import com.google.gwt.junit.tools.GWTTestSuite;
1919
import junit.framework.Test;
20-
import org.gwtproject.core.client.JavaScriptObjectTest;
21-
import org.gwtproject.core.client.JsArrayMixedTest;
22-
import org.gwtproject.core.client.JsArrayTest;
23-
import org.gwtproject.core.client.JsonUtilsTest;
24-
import org.gwtproject.core.client.SchedulerTest;
25-
import org.gwtproject.core.client.ScriptInjectorTest;
20+
import org.gwtproject.core.client.*;
2621
import org.gwtproject.core.client.impl.SchedulerImplTest;
2722

2823
public class CoreSuite {
2924

3025
public static Test suite() {
3126
GWTTestSuite suite = new GWTTestSuite("All core tests");
3227

28+
suite.addTestSuite(GWTTest.class);
3329
suite.addTestSuite(JavaScriptObjectTest.class);
3430
suite.addTestSuite(JsonUtilsTest.class);
3531
suite.addTestSuite(JsArrayTest.class);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.gwtproject.core.client;
2+
3+
import com.google.gwt.junit.client.GWTTestCase;
4+
5+
public class GWTTest extends GWTTestCase {
6+
@Override
7+
public String getModuleName() {
8+
return "org.gwtproject.core.Core";
9+
}
10+
11+
public void testIsScript() {
12+
assertTrue(GWT.isScript());
13+
assertTrue(org.gwtproject.core.shared.GWT.isScript());
14+
}
15+
16+
public void testIsClient() {
17+
assertTrue(GWT.isClient());
18+
assertTrue(org.gwtproject.core.shared.GWT.isClient());
19+
}
20+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.gwtproject.core.client;
2+
3+
import static org.junit.Assert.assertTrue;
4+
5+
import com.google.j2cl.junit.apt.J2clTestInput;
6+
import org.junit.Test;
7+
8+
@J2clTestInput(GWTTest.class)
9+
public class GWTTest {
10+
11+
@Test
12+
public void testIsScript() {
13+
assertTrue(GWT.isScript());
14+
assertTrue(org.gwtproject.core.shared.GWT.isScript());
15+
}
16+
17+
@Test
18+
public void testIsClient() {
19+
assertTrue(GWT.isClient());
20+
assertTrue(org.gwtproject.core.shared.GWT.isClient());
21+
}
22+
}

gwt-core/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,30 @@
6666
<artifactId>elemental2-dom</artifactId>
6767
<version>${elemental2.version}</version>
6868
</dependency>
69+
70+
<dependency>
71+
<groupId>junit</groupId>
72+
<artifactId>junit</artifactId>
73+
<version>4.12</version>
74+
<scope>test</scope>
75+
</dependency>
6976
</dependencies>
7077

7178
<build>
7279
<plugins>
80+
<plugin>
81+
<groupId>org.apache.maven.plugins</groupId>
82+
<artifactId>maven-surefire-plugin</artifactId>
83+
<version>3.0.0-M4</version>
84+
<executions>
85+
<execution>
86+
<id>test</id>
87+
<goals>
88+
<goal>test</goal>
89+
</goals>
90+
</execution>
91+
</executions>
92+
</plugin>
7393
<plugin>
7494
<groupId>net.ltgt.gwt.maven</groupId>
7595
<artifactId>gwt-maven-plugin</artifactId>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright © 2019 The GWT Authors
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+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.gwtproject.core.shared;
17+
18+
import static org.junit.Assert.assertFalse;
19+
20+
import org.junit.Test;
21+
22+
public class GWTTest {
23+
@Test
24+
public void testIsScript() {
25+
assertFalse(GWT.isScript());
26+
assertFalse(org.gwtproject.core.shared.GWT.isScript());
27+
}
28+
29+
@Test
30+
public void testIsClient() {
31+
assertFalse(GWT.isClient());
32+
assertFalse(org.gwtproject.core.shared.GWT.isClient());
33+
}
34+
35+
@Test
36+
public void testIsProdMode() {
37+
assertFalse(GWT.isProdMode());
38+
assertFalse(org.gwtproject.core.shared.GWT.isProdMode());
39+
}
40+
}

0 commit comments

Comments
 (0)