Super Dev Mode: fix tests to work better with Google
- Added tests to Google BUILD file.
- Switched to JUnit3 to match the rest of GWT.
- Renamed "tests" to "javatests" for consistency with Google conventions.
Change-Id: Ib969dec7db12e8a3362299ea066a5a11584603d0
Review-Link: https://gwt-review.googlesource.com/#/c/8924/
diff --git a/dev/codeserver/BUILD b/dev/codeserver/BUILD
index f163a98..4316b04 100644
--- a/dev/codeserver/BUILD
+++ b/dev/codeserver/BUILD
@@ -41,6 +41,25 @@
],
)
+java_library(
+ name = "testlib",
+ testonly = 1,
+ srcs = glob(["test/**/*.java"]),
+ deps = [
+ ":codeserver-bare",
+ "//third_party/java/junit",
+ "//third_party/java_src/gwt/svn/trunk/dev:gwt-dev-bare",
+ ],
+)
+
+java_test(
+ name = "tests",
+ test_class = "com.google.gwt.dev.codeserver.SourceHandlerTest",
+ runtime_deps = [
+ ":testlib",
+ ],
+)
+
# Repackaged codeserver for google3.
AugmentedJar(
name = "codeserver",
diff --git a/dev/codeserver/build.xml b/dev/codeserver/build.xml
index 5bac905..a3aca44 100755
--- a/dev/codeserver/build.xml
+++ b/dev/codeserver/build.xml
@@ -19,7 +19,7 @@
<mkdir dir="${javac.junit.out}" />
<javac destdir="${javac.junit.out}">
<src path="java" />
- <src path="test" />
+ <src path="javatests" />
<classpath>
<pathelement location="${javac.out}"/>
<pathelement location="${gwt.dev.jar}" />
diff --git a/dev/codeserver/test/com/google/gwt/dev/codeserver/SourceHandlerTest.java b/dev/codeserver/javatests/com/google/gwt/dev/codeserver/SourceHandlerTest.java
similarity index 74%
rename from dev/codeserver/test/com/google/gwt/dev/codeserver/SourceHandlerTest.java
rename to dev/codeserver/javatests/com/google/gwt/dev/codeserver/SourceHandlerTest.java
index c1a89a4..e1adff4 100644
--- a/dev/codeserver/test/com/google/gwt/dev/codeserver/SourceHandlerTest.java
+++ b/dev/codeserver/javatests/com/google/gwt/dev/codeserver/SourceHandlerTest.java
@@ -1,25 +1,31 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.codeserver;
import com.google.gwt.dev.util.Util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
+import junit.framework.TestCase;
/**
* Tests for {@link SourceHandler}
*/
-public class SourceHandlerTest {
+public class SourceHandlerTest extends TestCase {
private static final String VALID_STRONG_NAME = Util.computeStrongName("foo-bar".getBytes());
- /**
- * Test {@link SourceHandler#isSourceMapRequest(String)}
- */
- @Test
public void testIsSourceMapRequest() {
checkSourceMapRequest("/sourcemaps/myModule/");
checkSourceMapRequest("/sourcemaps/myModule/whatever");
@@ -31,10 +37,6 @@
checkNotSourceMapRequest("whatever/sourcemaps/myModule/");
}
- /**
- * Test {@link SourceHandler#getModuleNameFromRequest(String)}
- */
- @Test
public void testGetModuleNameFromRequest() {
assertEquals("myModule", SourceHandler.getModuleNameFromRequest(
"/sourcemaps/myModule/"));
@@ -42,10 +44,6 @@
"/sourcemaps/myModule/1234_sourcemap.json"));
}
- /**
- * Test {@link SourceHandler#getStrongNameFromSourcemapFilename(String)}
- */
- @Test
public void testGetStrongNameFromSourcemapFilename() {
assertEquals(VALID_STRONG_NAME, SourceHandler
.getStrongNameFromSourcemapFilename(VALID_STRONG_NAME + "_sourcemap.json"));