aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcpovirk <cpovirk@google.com>2024-02-06 13:07:28 -0800
committerDagger Team <dagger-dev+copybara@google.com>2024-02-06 13:09:10 -0800
commit76cebe1c72a4ceb33046d756a5ba4679d26a72e0 (patch)
treea0aea4ec71cec5febb06b53145f608d67c1014d3
parent388da49ef6f6789ade005202b2f3790173b8851e (diff)
downloaddagger2-76cebe1c72a4ceb33046d756a5ba4679d26a72e0.tar.gz
Migrate usages of `Truth8.assertThat` to equivalent usages of `Truth.assertThat`.
The `Truth8` methods will be deprecated (or hidden) in the future. Callers should move to `Truth`. Some (but not all) of the CLs in this batch require Truth [1.4.0](https://github.com/google/truth/releases/tag/v1.4.0). I submitted a CL earlier today to (I hope) perform that upgrade for your project. PiperOrigin-RevId: 604740587
-rw-r--r--javatests/dagger/functional/assisted/AssistedFactoryAsQualifiedBindingTest.java9
-rw-r--r--javatests/dagger/functional/jdk8/OptionalBindingComponentsPresentTest.java3
-rw-r--r--javatests/dagger/functional/producers/aot/ProducesMethodShadowsInjectConstructorTest.java3
-rw-r--r--javatests/dagger/internal/codegen/ComponentProcessorTest.java3
4 files changed, 7 insertions, 11 deletions
diff --git a/javatests/dagger/functional/assisted/AssistedFactoryAsQualifiedBindingTest.java b/javatests/dagger/functional/assisted/AssistedFactoryAsQualifiedBindingTest.java
index b85342420..afb5f7af8 100644
--- a/javatests/dagger/functional/assisted/AssistedFactoryAsQualifiedBindingTest.java
+++ b/javatests/dagger/functional/assisted/AssistedFactoryAsQualifiedBindingTest.java
@@ -19,7 +19,6 @@ package dagger.functional.assisted;
import static com.google.common.truth.Truth.assertThat;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import com.google.common.truth.Truth8;
import dagger.Binds;
import dagger.BindsInstance;
import dagger.BindsOptionalOf;
@@ -243,10 +242,10 @@ public final class AssistedFactoryAsQualifiedBindingTest {
assertThat(foo.barFactoryAsBinds).isEqualTo(barFactory);
// Test injection of a qualified Bar/BarFactory with custom @BindsOptionalOf implementation
- Truth8.assertThat(foo.optionalBar).isPresent();
- Truth8.assertThat(foo.optionalBar).hasValue(bar);
- Truth8.assertThat(foo.optionalBarFactory).isPresent();
- Truth8.assertThat(foo.optionalBarFactory).hasValue(barFactory);
+ assertThat(foo.optionalBar).isPresent();
+ assertThat(foo.optionalBar).hasValue(bar);
+ assertThat(foo.optionalBarFactory).isPresent();
+ assertThat(foo.optionalBarFactory).hasValue(barFactory);
// Test injection of a qualified Bar/BarFactory as multibinding
assertThat(foo.barSet).containsExactly(bar);
diff --git a/javatests/dagger/functional/jdk8/OptionalBindingComponentsPresentTest.java b/javatests/dagger/functional/jdk8/OptionalBindingComponentsPresentTest.java
index 2841c6faf..0e91dc51b 100644
--- a/javatests/dagger/functional/jdk8/OptionalBindingComponentsPresentTest.java
+++ b/javatests/dagger/functional/jdk8/OptionalBindingComponentsPresentTest.java
@@ -21,7 +21,6 @@ import static dagger.functional.jdk8.OptionalBindingComponents.Value.QUALIFIED_V
import static dagger.functional.jdk8.OptionalBindingComponents.Value.VALUE;
import com.google.common.collect.ImmutableList;
-import com.google.common.truth.Truth8;
import dagger.functional.jdk8.OptionalBindingComponents.OptionalBindingComponent;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -64,7 +63,7 @@ public final class OptionalBindingComponentsPresentTest {
@Test
public void qualifiedOptional() {
- Truth8.assertThat(component.qualifiedValues().optionalInstance()).hasValue(QUALIFIED_VALUE);
+ assertThat(component.qualifiedValues().optionalInstance()).hasValue(QUALIFIED_VALUE);
}
@Test
diff --git a/javatests/dagger/functional/producers/aot/ProducesMethodShadowsInjectConstructorTest.java b/javatests/dagger/functional/producers/aot/ProducesMethodShadowsInjectConstructorTest.java
index 646454b4e..548ad1dbd 100644
--- a/javatests/dagger/functional/producers/aot/ProducesMethodShadowsInjectConstructorTest.java
+++ b/javatests/dagger/functional/producers/aot/ProducesMethodShadowsInjectConstructorTest.java
@@ -18,7 +18,6 @@ package dagger.functional.producers.aot;
import static com.google.common.truth.Truth.assertThat;
-import com.google.common.truth.Truth8;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import dagger.BindsOptionalOf;
@@ -113,6 +112,6 @@ public class ProducesMethodShadowsInjectConstructorTest {
Leaf leaf = DaggerProducesMethodShadowsInjectConstructorTest_Root.create().leaf();
leaf.dependsOnShadowingProducer().get();
assertThat(leaf.shadowedProvisionMultibinding().get()).hasSize(2);
- Truth8.assertThat(leaf.emptyProvisionBindingToPresentProductionBinding().get()).isPresent();
+ assertThat(leaf.emptyProvisionBindingToPresentProductionBinding().get()).isPresent();
}
}
diff --git a/javatests/dagger/internal/codegen/ComponentProcessorTest.java b/javatests/dagger/internal/codegen/ComponentProcessorTest.java
index 0705d43f7..90c7b2925 100644
--- a/javatests/dagger/internal/codegen/ComponentProcessorTest.java
+++ b/javatests/dagger/internal/codegen/ComponentProcessorTest.java
@@ -23,7 +23,6 @@ import androidx.room.compiler.processing.util.CompilationResultSubject;
import androidx.room.compiler.processing.util.Source;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.common.truth.Truth8;
import com.squareup.javapoet.AnnotationSpec;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeSpec;
@@ -1432,7 +1431,7 @@ public class ComponentProcessorTest {
}
private void assertDoesNotHaveNoteContaining(CompilationResultSubject subject, String content) {
- Truth8.assertThat(
+ assertThat(
subject.getCompilationResult().getDiagnostics().get(Diagnostic.Kind.NOTE).stream()
.filter(diagnostic -> diagnostic.getMsg().contains(content)))
.isEmpty();