aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar lberki <lberki@google.com>2017-05-24 15:09:05 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-05-26 09:34:40 +0200
commitaa108cdd7f25f39155266211a98bba34d7627605 (patch)
treec097d95e1f94a57165202ba2c96b36270cbca178
parentd2babf8f3524f821ddc6f70389dd185838cd4970 (diff)
Migrate tests to Truth.
RELNOTES: None. PiperOrigin-RevId: 156979845
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/config/ConfigSettingTest.java40
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/repository/RepositoryFunctionTest.java9
2 files changed, 22 insertions, 27 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/config/ConfigSettingTest.java b/src/test/java/com/google/devtools/build/lib/rules/config/ConfigSettingTest.java
index 6aed49215e..26168f6cd3 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/config/ConfigSettingTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/config/ConfigSettingTest.java
@@ -14,9 +14,6 @@
package com.google.devtools.build.lib.rules.config;
import static com.google.common.truth.Truth.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -151,19 +148,19 @@ public class ConfigSettingTest extends BuildViewTestCase {
// First flag mismatches:
useConfiguration("-c", "opt", "--stamp");
- assertFalse(getConfigMatchingProvider("//pkg:foo").matches());
+ assertThat(getConfigMatchingProvider("//pkg:foo").matches()).isFalse();
// Second flag mismatches:
useConfiguration("-c", "dbg", "--nostamp");
- assertFalse(getConfigMatchingProvider("//pkg:foo").matches());
+ assertThat(getConfigMatchingProvider("//pkg:foo").matches()).isFalse();
// Both flags mismatch:
useConfiguration("-c", "opt", "--nostamp");
- assertFalse(getConfigMatchingProvider("//pkg:foo").matches());
+ assertThat(getConfigMatchingProvider("//pkg:foo").matches()).isFalse();
// Both flags match:
useConfiguration("-c", "dbg", "--stamp");
- assertTrue(getConfigMatchingProvider("//pkg:foo").matches());
+ assertThat(getConfigMatchingProvider("//pkg:foo").matches()).isTrue();
}
/**
@@ -172,9 +169,8 @@ public class ConfigSettingTest extends BuildViewTestCase {
@Test
public void labelGetter() throws Exception {
writeSimpleExample();
- assertEquals(
- Label.parseAbsolute("//pkg:foo"),
- getConfigMatchingProvider("//pkg:foo").label());
+ assertThat(getConfigMatchingProvider("//pkg:foo").label())
+ .isEqualTo(Label.parseAbsolute("//pkg:foo"));
}
/**
@@ -254,7 +250,7 @@ public class ConfigSettingTest extends BuildViewTestCase {
" name = 'match',",
" values = { 'opt_with_default': 'overridden' }",
")");
- assertTrue(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isTrue();
}
/**
@@ -270,17 +266,17 @@ public class ConfigSettingTest extends BuildViewTestCase {
" })");
useConfiguration("");
- assertFalse(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isFalse();
useConfiguration("--define", "foo=bar");
- assertTrue(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isTrue();
useConfiguration("--define", "foo=baz");
- assertFalse(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isFalse();
useConfiguration("--define", "foo=bar", "--define", "bar=baz");
- assertTrue(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isTrue();
useConfiguration("--define", "foo=bar", "--define", "bar=baz", "--define", "foo=nope");
- assertFalse(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isFalse();
useConfiguration("--define", "foo=nope", "--define", "bar=baz", "--define", "foo=bar");
- assertTrue(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isTrue();
}
/**
@@ -296,15 +292,15 @@ public class ConfigSettingTest extends BuildViewTestCase {
" })");
useConfiguration("");
- assertFalse(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isFalse();
useConfiguration("--copt", "-Dfoo");
- assertTrue(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isTrue();
useConfiguration("--copt", "-Dbar");
- assertFalse(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isFalse();
useConfiguration("--copt", "-Dfoo", "--copt", "-Dbar");
- assertTrue(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isTrue();
useConfiguration("--copt", "-Dbar", "--copt", "-Dfoo");
- assertTrue(getConfigMatchingProvider("//test:match").matches());
+ assertThat(getConfigMatchingProvider("//test:match").matches()).isTrue();
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/rules/repository/RepositoryFunctionTest.java b/src/test/java/com/google/devtools/build/lib/rules/repository/RepositoryFunctionTest.java
index c9e1afacc0..d550924212 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/repository/RepositoryFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/repository/RepositoryFunctionTest.java
@@ -15,7 +15,6 @@
package com.google.devtools.build.lib.rules.repository;
import static com.google.common.truth.Truth.assertThat;
-import static org.junit.Assert.assertEquals;
import com.google.common.annotations.VisibleForTesting;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
@@ -69,8 +68,8 @@ public class RepositoryFunctionTest extends BuildViewTestCase {
" name = 'z',",
" path = 'a/b/c',",
")");
- assertEquals(rootDirectory.getRelative("a/b/c").asFragment(),
- TestingRepositoryFunction.getTargetPath(rule, rootDirectory));
+ assertThat(TestingRepositoryFunction.getTargetPath(rule, rootDirectory))
+ .isEqualTo(rootDirectory.getRelative("a/b/c").asFragment());
}
@Test
@@ -79,8 +78,8 @@ public class RepositoryFunctionTest extends BuildViewTestCase {
" name = 'w',",
" path = '/a/b/c',",
")");
- assertEquals(PathFragment.create("/a/b/c"),
- TestingRepositoryFunction.getTargetPath(rule, rootDirectory));
+ assertThat(TestingRepositoryFunction.getTargetPath(rule, rootDirectory))
+ .isEqualTo(PathFragment.create("/a/b/c"));
}
@Test