Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import java.math.BigDecimal;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@link BigDecimal} values.
*/
/** A subject for {@link BigDecimal} values. */
public final class BigDecimalSubject extends ComparableSubject<BigDecimal> {
private final @Nullable BigDecimal actual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

import org.jspecify.annotations.Nullable;

/**
* A subject for {@link Boolean} values.
*/
/** A subject for {@link Boolean} values. */
public final class BooleanSubject extends Subject {
private final @Nullable Boolean actual;

Expand Down
4 changes: 1 addition & 3 deletions core/src/main/java/com/google/common/truth/ClassSubject.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
import com.google.common.annotations.GwtIncompatible;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@link Class} values.
*/
/** A subject for {@link Class} values. */
@GwtIncompatible("reflection")
@J2ktIncompatible
public final class ClassSubject extends Subject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@

import org.jspecify.annotations.Nullable;

/**
* A subject for {@link Double} values.
*/
/** A subject for {@link Double} values. */
public final class DoubleSubject extends ComparableSubject<Double> {
private final @Nullable Double actual;

Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/com/google/common/truth/Fact.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ String getKey() {
return key;
}

@Nullable
String getValue() {
@Nullable String getValue() {
return value;
}

Expand Down
4 changes: 1 addition & 3 deletions core/src/main/java/com/google/common/truth/FloatSubject.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@

import org.jspecify.annotations.Nullable;

/**
* A subject for {@link Float} values.
*/
/** A subject for {@link Float} values. */
public final class FloatSubject extends ComparableSubject<Float> {
private final @Nullable Float actual;
private final DoubleSubject asDouble;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@

import org.jspecify.annotations.Nullable;

/**
* A subject for {@link Integer} values.
*/
/** A subject for {@link Integer} values. */
public class IntegerSubject extends ComparableSubject<Integer> {
private final @Nullable Integer actual;

Expand Down
4 changes: 1 addition & 3 deletions core/src/main/java/com/google/common/truth/LongSubject.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

import org.jspecify.annotations.Nullable;

/**
* A subject for {@link Long} values.
*/
/** A subject for {@link Long} values. */
public class LongSubject extends ComparableSubject<Long> {

private final @Nullable Long actual;
Expand Down
4 changes: 1 addition & 3 deletions core/src/main/java/com/google/common/truth/MapSubject.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@
import java.util.Set;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@link Map} values.
*/
/** A subject for {@link Map} values. */
public class MapSubject extends Subject {
private final @Nullable Map<?, ?> actual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
import java.util.Set;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@link Multimap} values.
*/
/** A subject for {@link Multimap} values. */
public class MultimapSubject extends Subject {
private final @Nullable Multimap<?, ?> actual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import com.google.common.collect.Multiset;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@link Multiset} values.
*/
/** A subject for {@link Multiset} values. */
public final class MultisetSubject extends IterableSubject {

private final @Nullable Multiset<?> actual;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import java.util.Arrays;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@code Object[]} and more generically {@code T[]}.
*/
/** A subject for {@code Object[]} and more generically {@code T[]}. */
public final class ObjectArraySubject<T extends @Nullable Object> extends Subject {
private final T @Nullable [] actual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import com.google.common.primitives.Booleans;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@code boolean[]} values.
*/
/** A subject for {@code boolean[]} values. */
public final class PrimitiveBooleanArraySubject extends Subject {
private final boolean @Nullable [] actual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import com.google.common.primitives.Bytes;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@code byte[]} values.
*/
/** A subject for {@code byte[]} values. */
public final class PrimitiveByteArraySubject extends Subject {
private final byte @Nullable [] actual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import com.google.common.primitives.Chars;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@code char[]} values.
*/
/** A subject for {@code char[]} values. */
public final class PrimitiveCharArraySubject extends Subject {
private final char @Nullable [] actual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
import java.util.Arrays;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@code double[]} values.
*/
/** A subject for {@code double[]} values. */
public final class PrimitiveDoubleArraySubject extends Subject {
private final double @Nullable [] actual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
import java.util.Arrays;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@code float[]} values.
*/
/** A subject for {@code float[]} values. */
public final class PrimitiveFloatArraySubject extends Subject {
private final float @Nullable [] actual;

Expand Down Expand Up @@ -131,9 +129,9 @@ private static float checkedToFloat(Number expected) {
expected instanceof Float || expected instanceof Integer || expected instanceof Long;
if (!okType) {
throw new IllegalArgumentException(
"Expected value in assertion using exact float equality was of unsupported type "
+ SubjectUtils.longName(expected.getClass())
+ " (it may not have an exact float representation)");
"Expected value in assertion using exact float equality was of unsupported type "
+ SubjectUtils.longName(expected.getClass())
+ " (it may not have an exact float representation)");
}
if (expected instanceof Integer) {
checkArgument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import com.google.common.primitives.Ints;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@code int[]} values.
*/
/** A subject for {@code int[]} values. */
public final class PrimitiveIntArraySubject extends Subject {
private final int @Nullable [] actual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import com.google.common.primitives.Longs;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@code long[]} values.
*/
/** A subject for {@code long[]} values. */
public final class PrimitiveLongArraySubject extends Subject {
private final long @Nullable [] actual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import com.google.common.primitives.Shorts;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@code short[]} values.
*/
/** A subject for {@code short[]} values. */
public final class PrimitiveShortArraySubject extends Subject {
private final short @Nullable [] actual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ private static boolean isTruthEntrance(StackTraceElement stackTraceElement) {
return isFromClassOrClassNestedInside(stackTraceElement, SUBJECT_CLASS)
/*
* Don't match classes _nested inside_ StandardSubjectBuilder because that would match
* Expect's Statement implementation. While we want to strip everything from there _down_, we
* don't want to strip everything from there _up_ (which would strip the test class itself!).
* Expect's Statement implementation. While we want to strip everything from there _down_,
* we don't want to strip everything from there _up_ (which would strip the test class
* itself!).
*
* (StandardSubjectBuilder is listed here only for its fail() methods, anyway, so we don't
* have to worry about nested classes like we do with Subject.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public final class StreamSubject extends Subject {
private final @Nullable Stream<?> actual;
private final Supplier<@Nullable List<?>> listSupplier;

private StreamSubject(
FailureMetadata metadata,
@Nullable Stream<?> actual) {
private StreamSubject(FailureMetadata metadata, @Nullable Stream<?> actual) {
super(metadata, actual);
this.actual = actual;
this.listSupplier =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
import java.util.regex.Pattern;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@link String} values.
*/
/** A subject for {@link String} values. */
public class StringSubject extends ComparableSubject<String> {
private final @Nullable String actual;

Expand Down
4 changes: 1 addition & 3 deletions core/src/main/java/com/google/common/truth/SubjectUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
import java.util.concurrent.TimeoutException;
import org.jspecify.annotations.Nullable;

/**
* Utility methods used in {@link Subject} implementors.
*/
/** Utility methods used in {@link Subject} implementors. */
final class SubjectUtils {
private SubjectUtils() {}

Expand Down
4 changes: 1 addition & 3 deletions core/src/main/java/com/google/common/truth/TableSubject.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
import com.google.common.collect.Tables;
import org.jspecify.annotations.Nullable;

/**
* A subject for {@link Table} values.
*/
/** A subject for {@link Table} values. */
public final class TableSubject extends Subject {
private final @Nullable Table<?, ?, ?> actual;

Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/com/google/common/truth/Truth.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ public static StandardSubjectBuilder assert_() {
* StandardSubjectBuilder#about about(...)}, as discussed in <a
* href="https://truth.dev/faq#java8">this FAQ entry</a>.
*/
public static StandardSubjectBuilder assertWithMessage(
@Nullable String message) {
public static StandardSubjectBuilder assertWithMessage(@Nullable String message) {
return assert_().withMessage(message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests (and effectively sample code) for custom error message for checks.
*/
/** Tests (and effectively sample code) for custom error message for checks. */
@SuppressWarnings("LenientFormatStringValidation") // Intentional for testing
@RunWith(JUnit4.class)
public class CustomFailureMessageTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1277,8 +1277,8 @@ public void containsExactly_nullValueInArray() {
public void containsExactly_nullArray() {
// Truth is tolerant of this erroneous varargs call.
List<String> actual = Arrays.asList((String) null);
IterableSubject.UsingCorrespondence<String, Integer> subject = assertThat(actual)
.comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE);
IterableSubject.UsingCorrespondence<String, Integer> subject =
assertThat(actual).comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE);
Ordered ordered;
try {
ordered = subject.containsExactly((Integer[]) null);
Expand Down
12 changes: 6 additions & 6 deletions core/src/test/java/com/google/common/truth/MapSubjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1518,8 +1518,8 @@ public void comparingValuesUsing_containsEntry_handlesFormatDiffExceptions() {
assertThat(e)
.factValue("first exception", 0)
.startsWith(
"compare(null, 60) threw"
+ " com.google.common.truth.TestCorrespondences$NullPointerExceptionFromWithin10Of");
"compare(null, 60) threw "
+ "com.google.common.truth.TestCorrespondences$NullPointerExceptionFromWithin10Of");
assertThat(e)
.factValue("first exception", 1)
.startsWith("formatDiff(null, 60) threw java.lang.NullPointerException");
Expand Down Expand Up @@ -2059,8 +2059,8 @@ public void comparingValuesUsing_containsExactlyEntriesIn_handlesFormatDiffExcep
assertThat(e)
.factValue("first exception", 0)
.startsWith(
"compare(null, 60) threw"
+ " com.google.common.truth.TestCorrespondences$NullPointerExceptionFromWithin10Of");
"compare(null, 60) threw "
+ "com.google.common.truth.TestCorrespondences$NullPointerExceptionFromWithin10Of");
assertThat(e)
.factValue("first exception", 1)
.startsWith("formatDiff(null, 60) threw java.lang.NullPointerException");
Expand Down Expand Up @@ -2494,8 +2494,8 @@ public void comparingValuesUsing_containsAtLeastEntriesIn_handlesFormatDiffExcep
assertThat(e)
.factValue("first exception", 0)
.startsWith(
"compare(null, 60) threw"
+ " com.google.common.truth.TestCorrespondences$NullPointerExceptionFromWithin10Of");
"compare(null, 60) threw "
+ "com.google.common.truth.TestCorrespondences$NullPointerExceptionFromWithin10Of");
assertThat(e)
.factValue("first exception", 1)
.startsWith("formatDiff(null, 60) threw java.lang.NullPointerException");
Expand Down
4 changes: 1 addition & 3 deletions core/src/test/java/com/google/common/truth/MathUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests for {@link MathUtil} used by numeric subjects.
*/
/** Tests for {@link MathUtil} used by numeric subjects. */
@RunWith(JUnit4.class)
public class MathUtilTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests for comparisons between various integral types.
*/
/** Tests for comparisons between various integral types. */
@RunWith(JUnit4.class)
@SuppressWarnings("SelfAssertion")
public class NumericComparisonTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Tests for {@link PrimitiveShortArraySubject}.
*/
/** Tests for {@link PrimitiveShortArraySubject}. */
@RunWith(JUnit4.class)
public class PrimitiveShortArraySubjectTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import com.google.common.truth.Subject;
import com.google.errorprone.annotations.CheckReturnValue;
import com.google.protobuf.MessageLite;
import org.jspecify.annotations.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/**
* A set of static methods to begin a Truth assertion chain for the lite version of protocol
Expand Down
Loading
Loading