Migrated tests in devtools/build/lib/skyframe to JUnit 4.
--
MOS_MIGRATED_REVID=109286530
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java
index 72a47a5..45d6996 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java
@@ -13,13 +13,17 @@
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.testing.EqualsTester;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.events.NullEventHandler;
import com.google.devtools.build.lib.pkgcache.PathPackageLocator;
-import com.google.devtools.build.lib.testutil.FoundationTestCase;
+import com.google.devtools.build.lib.testutil.FoundationTestCaseForJunit4;
import com.google.devtools.build.lib.util.BlazeClock;
import com.google.devtools.build.lib.util.io.TimestampGranularityMonitor;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -31,6 +35,11 @@
import com.google.devtools.build.skyframe.SkyFunctionName;
import com.google.devtools.build.skyframe.SkyKey;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@@ -39,15 +48,15 @@
/**
* Tests for {@link ContainingPackageLookupFunction}.
*/
-public class ContainingPackageLookupFunctionTest extends FoundationTestCase {
+@RunWith(JUnit4.class)
+public class ContainingPackageLookupFunctionTest extends FoundationTestCaseForJunit4 {
private AtomicReference<ImmutableSet<PackageIdentifier>> deletedPackages;
private MemoizingEvaluator evaluator;
private SequentialBuildDriver driver;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public final void setUp() throws Exception {
AtomicReference<PathPackageLocator> pkgLocator =
new AtomicReference<>(new PathPackageLocator(outputBase, ImmutableList.of(rootDirectory)));
deletedPackages = new AtomicReference<>(ImmutableSet.<PackageIdentifier>of());
@@ -83,11 +92,13 @@
.get(key);
}
+ @Test
public void testNoContainingPackage() throws Exception {
ContainingPackageLookupValue value = lookupContainingPackage("a/b");
assertFalse(value.hasContainingPackage());
}
+ @Test
public void testContainingPackageIsParent() throws Exception {
scratch.file("a/BUILD");
ContainingPackageLookupValue value = lookupContainingPackage("a/b");
@@ -96,6 +107,7 @@
assertEquals(rootDirectory, value.getContainingPackageRoot());
}
+ @Test
public void testContainingPackageIsSelf() throws Exception {
scratch.file("a/b/BUILD");
ContainingPackageLookupValue value = lookupContainingPackage("a/b");
@@ -104,6 +116,7 @@
assertEquals(rootDirectory, value.getContainingPackageRoot());
}
+ @Test
public void testEqualsAndHashCodeContract() throws Exception {
ContainingPackageLookupValue valueA1 = ContainingPackageLookupValue.NONE;
ContainingPackageLookupValue valueA2 = ContainingPackageLookupValue.NONE;