diff options
author | 2017-05-30 12:35:33 +0200 | |
---|---|---|
committer | 2017-05-30 12:51:57 +0200 | |
commit | aea56b36af994b269800602e36000c293cabd00b (patch) | |
tree | 794f6b3b2528353cc39bd383730d408d4ff25233 /src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java | |
parent | 229f393bf460700594ae032a551879e026bd0b91 (diff) |
Migrate Java tests to Truth.
RELNOTES: None.
PiperOrigin-RevId: 157446717
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java index d5dc696df8..fb30097765 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java @@ -16,8 +16,6 @@ package com.google.devtools.build.lib.skylark; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; import static com.google.devtools.build.lib.analysis.OutputGroupProvider.INTERNAL_SUFFIX; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import com.google.common.base.Joiner; @@ -423,7 +421,7 @@ public class SkylarkIntegrationTest extends BuildViewTestCase { ConfiguredTarget target = getConfiguredTarget("//test/skylark:cr"); - assertEquals("//test/skylark:cr", target.getLabel().toString()); + assertThat(target.getLabel().toString()).isEqualTo("//test/skylark:cr"); assertThat( ActionsTestUtil.baseArtifactNames( target.getProvider(FileProvider.class).getFilesToBuild())) @@ -450,7 +448,7 @@ public class SkylarkIntegrationTest extends BuildViewTestCase { ConfiguredTarget target = getConfiguredTarget("//test/skylark:cr"); - assertEquals("//test/skylark:cr", target.getLabel().toString()); + assertThat(target.getLabel().toString()).isEqualTo("//test/skylark:cr"); assertThat( ActionsTestUtil.baseArtifactNames( target.getProvider(RunfilesProvider.class).getDefaultRunfiles().getAllArtifacts())) @@ -515,8 +513,8 @@ public class SkylarkIntegrationTest extends BuildViewTestCase { ConfiguredTarget target = getConfiguredTarget("//test/skylark:cr"); - assertEquals("//test/skylark:cr", target.getLabel().toString()); - assertTrue(target.getProvider(RunfilesProvider.class).getDefaultRunfiles().isEmpty()); + assertThat(target.getLabel().toString()).isEqualTo("//test/skylark:cr"); + assertThat(target.getProvider(RunfilesProvider.class).getDefaultRunfiles().isEmpty()).isTrue(); assertThat( ActionsTestUtil.baseArtifactNames( target.getProvider(RunfilesProvider.class).getDataRunfiles().getAllArtifacts())) @@ -543,7 +541,7 @@ public class SkylarkIntegrationTest extends BuildViewTestCase { ConfiguredTarget target = getConfiguredTarget("//test/skylark:cr"); - assertEquals("//test/skylark:cr", target.getLabel().toString()); + assertThat(target.getLabel().toString()).isEqualTo("//test/skylark:cr"); assertThat( ActionsTestUtil.baseArtifactNames( target.getProvider(RunfilesProvider.class).getDefaultRunfiles().getAllArtifacts())) @@ -601,7 +599,7 @@ public class SkylarkIntegrationTest extends BuildViewTestCase { ConfiguredTarget target = getConfiguredTarget("//test/skylark:cr"); - assertEquals("//test/skylark:cr", target.getLabel().toString()); + assertThat(target.getLabel().toString()).isEqualTo("//test/skylark:cr"); InstrumentedFilesProvider provider = target.getProvider(InstrumentedFilesProvider.class); assertWithMessage("InstrumentedFilesProvider should be set.").that(provider).isNotNull(); assertThat(ActionsTestUtil.baseArtifactNames(provider.getInstrumentedFiles())).isEmpty(); @@ -633,7 +631,7 @@ public class SkylarkIntegrationTest extends BuildViewTestCase { ConfiguredTarget target = getConfiguredTarget("//test/skylark:cr"); - assertEquals("//test/skylark:cr", target.getLabel().toString()); + assertThat(target.getLabel().toString()).isEqualTo("//test/skylark:cr"); InstrumentedFilesProvider provider = target.getProvider(InstrumentedFilesProvider.class); assertWithMessage("InstrumentedFilesProvider should be set.").that(provider).isNotNull(); assertThat(ActionsTestUtil.baseArtifactNames(provider.getInstrumentedFiles())) @@ -923,8 +921,8 @@ public class SkylarkIntegrationTest extends BuildViewTestCase { "custom_rule(name = 'cr')"); ConfiguredTarget target = getConfiguredTarget("//test/skylark:cr"); - assertEquals(Runtime.NONE, target.get("o1")); - assertEquals(MutableList.EMPTY, target.get("o2")); + assertThat(target.get("o1")).isEqualTo(Runtime.NONE); + assertThat(target.get("o2")).isEqualTo(MutableList.EMPTY); } @Test @@ -1112,7 +1110,7 @@ public class SkylarkIntegrationTest extends BuildViewTestCase { ConfiguredTarget target = getConfiguredTarget("//test/skylark:cr"); - assertEquals("//test/skylark:cr", target.getLabel().toString()); + assertThat(target.getLabel().toString()).isEqualTo("//test/skylark:cr"); assertThat( ActionsTestUtil.baseArtifactNames( target.getProvider(FileProvider.class).getFilesToBuild())) @@ -1353,9 +1351,9 @@ public class SkylarkIntegrationTest extends BuildViewTestCase { } catch (BuildFileContainsErrorsException e) { // The reason that this is an exception and not reported to the event handler is that the // error is reported by the parent sky function, which we don't have here. - assertThat(e.getMessage()).contains("Skylark import cycle"); - assertThat(e.getMessage()).contains("test/skylark:ext1.bzl"); - assertThat(e.getMessage()).contains("test/skylark:ext2.bzl"); + assertThat(e).hasMessageThat().contains("Skylark import cycle"); + assertThat(e).hasMessageThat().contains("test/skylark:ext1.bzl"); + assertThat(e).hasMessageThat().contains("test/skylark:ext2.bzl"); } } @@ -1379,10 +1377,10 @@ public class SkylarkIntegrationTest extends BuildViewTestCase { } catch (BuildFileContainsErrorsException e) { // The reason that this is an exception and not reported to the event handler is that the // error is reported by the parent sky function, which we don't have here. - assertThat(e.getMessage()).contains("Skylark import cycle"); - assertThat(e.getMessage()).contains("//test/skylark:ext2.bzl"); - assertThat(e.getMessage()).contains("//test/skylark:ext3.bzl"); - assertThat(e.getMessage()).contains("//test/skylark:ext4.bzl"); + assertThat(e).hasMessageThat().contains("Skylark import cycle"); + assertThat(e).hasMessageThat().contains("//test/skylark:ext2.bzl"); + assertThat(e).hasMessageThat().contains("//test/skylark:ext3.bzl"); + assertThat(e).hasMessageThat().contains("//test/skylark:ext4.bzl"); } } |