Skip to content

Commit

Permalink
Added ObjectArraySubject and the remaining primitive array subjects.
Browse files Browse the repository at this point in the history
Methods usingTolerance and usingExactEquality in float and double subjects are still missing, because they require Correspondence that we don't have yet.

Notes for API Council: this library is not published, API tracking is only used to check diffs during code reviews.

Test: ./gradlew :kruth:kruth:allTests
Relnote: N/A
Change-Id: I7bf66c90c9a46cefba3c59f9df19c1c2857f75d1
  • Loading branch information
arkivanov committed Nov 29, 2023
1 parent 73ae646 commit 9720905
Show file tree
Hide file tree
Showing 29 changed files with 2,012 additions and 61 deletions.
20 changes: 20 additions & 0 deletions kruth/kruth/api/api_lint.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ ArrayReturn: androidx.kruth.IterableSubject#containsExactlyElementsIn(Object[])
Method parameter should be Collection<Object> (or subclass) instead of raw array; was `java.lang.Object[]`
ArrayReturn: androidx.kruth.IterableSubject#containsNoneIn(Object[]) parameter #0:
Method parameter should be Collection<Object> (or subclass) instead of raw array; was `java.lang.Object[]`
ArrayReturn: androidx.kruth.KruthKt#assertThat(T[]) parameter #0:
Method parameter should be Collection<T> (or subclass) instead of raw array; was `T[]`
ArrayReturn: androidx.kruth.StandardSubjectBuilder#that(T[]) parameter #0:
Method parameter should be Collection<T> (or subclass) instead of raw array; was `T[]`


AutoBoxing: androidx.kruth.KruthKt#assertThat(Boolean) parameter #0:
Expand Down Expand Up @@ -43,10 +47,26 @@ BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(String):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(String)
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(T):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(T)
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(T[]):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(T[])
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(boolean[]):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(boolean[])
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(byte[]):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(byte[])
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(char[]):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(char[])
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(double[]):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(double[])
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(float[]):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(float[])
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(int[]):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(int[])
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(java.util.Map<K,? extends V>):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(java.util.Map<K,? extends V>)
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(long[]):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(long[])
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(short[]):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(short[])
BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#withMessage(String):
Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.withMessage(String)

Expand Down
44 changes: 26 additions & 18 deletions kruth/kruth/api/current.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,20 @@ AddedFinal: androidx.kruth.ThrowableSubject:
Class androidx.kruth.ThrowableSubject added 'final' qualifier


ChangedType: androidx.kruth.ObjectArraySubject#asList():
Method androidx.kruth.ObjectArraySubject.asList has changed return type from androidx.kruth.IterableSubject to androidx.kruth.IterableSubject<?>
ChangedType: androidx.kruth.PrimitiveBooleanArraySubject#asList():
Method androidx.kruth.PrimitiveBooleanArraySubject.asList has changed return type from androidx.kruth.IterableSubject to androidx.kruth.IterableSubject<java.lang.Boolean>
ChangedType: androidx.kruth.PrimitiveByteArraySubject#asList():
Method androidx.kruth.PrimitiveByteArraySubject.asList has changed return type from androidx.kruth.IterableSubject to androidx.kruth.IterableSubject<java.lang.Byte>
ChangedType: androidx.kruth.PrimitiveCharArraySubject#asList():
Method androidx.kruth.PrimitiveCharArraySubject.asList has changed return type from androidx.kruth.IterableSubject to androidx.kruth.IterableSubject<java.lang.Character>
ChangedType: androidx.kruth.PrimitiveIntArraySubject#asList():
Method androidx.kruth.PrimitiveIntArraySubject.asList has changed return type from androidx.kruth.IterableSubject to androidx.kruth.IterableSubject<java.lang.Integer>
ChangedType: androidx.kruth.PrimitiveLongArraySubject#asList():
Method androidx.kruth.PrimitiveLongArraySubject.asList has changed return type from androidx.kruth.IterableSubject to androidx.kruth.IterableSubject<java.lang.Long>
ChangedType: androidx.kruth.PrimitiveShortArraySubject#asList():
Method androidx.kruth.PrimitiveShortArraySubject.asList has changed return type from androidx.kruth.IterableSubject to androidx.kruth.IterableSubject<java.lang.Short>
ChangedType: androidx.kruth.SimpleSubjectBuilder#that(T):
Method androidx.kruth.SimpleSubjectBuilder.that has changed return type from SubjectT (extends androidx.kruth.Subject) to S (extends androidx.kruth.Subject<? extends T>)
ChangedType: androidx.kruth.StandardSubjectBuilder#about(androidx.kruth.Subject.Factory<? extends S,T>):
Expand All @@ -51,8 +63,8 @@ ChangedType: androidx.kruth.StandardSubjectBuilder#that(Iterable<? extends T>):
Method androidx.kruth.StandardSubjectBuilder.that has changed return type from androidx.kruth.IterableSubject to androidx.kruth.IterableSubject<T>
ChangedType: androidx.kruth.StandardSubjectBuilder#that(T):
Method androidx.kruth.StandardSubjectBuilder.that has changed return type from androidx.kruth.ClassSubject to androidx.kruth.Subject<T>
ChangedType: androidx.kruth.StandardSubjectBuilder#that(byte[]):
Method androidx.kruth.StandardSubjectBuilder.that has changed return type from androidx.kruth.ObjectArraySubject<T> to androidx.kruth.PrimitiveByteArraySubject
ChangedType: androidx.kruth.StandardSubjectBuilder#that(T[]):
Method androidx.kruth.StandardSubjectBuilder.that has changed return type from androidx.kruth.ObjectArraySubject<T> to androidx.kruth.ObjectArraySubject<T>
ChangedType: androidx.kruth.StandardSubjectBuilder#that(java.util.Map<K,? extends V>):
Method androidx.kruth.StandardSubjectBuilder.that has changed return type from androidx.kruth.MapSubject to androidx.kruth.MapSubject<K,V>
ChangedType: androidx.kruth.Subject#failWithActual(String, Object):
Expand Down Expand Up @@ -123,22 +135,10 @@ RemovedClass: androidx.kruth.MultimapSubject:
Removed class androidx.kruth.MultimapSubject
RemovedClass: androidx.kruth.MultisetSubject:
Removed class androidx.kruth.MultisetSubject
RemovedClass: androidx.kruth.ObjectArraySubject:
Removed class androidx.kruth.ObjectArraySubject
RemovedClass: androidx.kruth.PrimitiveBooleanArraySubject:
Removed class androidx.kruth.PrimitiveBooleanArraySubject
RemovedClass: androidx.kruth.PrimitiveCharArraySubject:
Removed class androidx.kruth.PrimitiveCharArraySubject
RemovedClass: androidx.kruth.PrimitiveDoubleArraySubject:
Removed class androidx.kruth.PrimitiveDoubleArraySubject
RemovedClass: androidx.kruth.PrimitiveFloatArraySubject:
Removed class androidx.kruth.PrimitiveFloatArraySubject
RemovedClass: androidx.kruth.PrimitiveIntArraySubject:
Removed class androidx.kruth.PrimitiveIntArraySubject
RemovedClass: androidx.kruth.PrimitiveLongArraySubject:
Removed class androidx.kruth.PrimitiveLongArraySubject
RemovedClass: androidx.kruth.PrimitiveShortArraySubject:
Removed class androidx.kruth.PrimitiveShortArraySubject
RemovedClass: androidx.kruth.PrimitiveDoubleArraySubject.DoubleArrayAsIterable:
Removed class androidx.kruth.PrimitiveDoubleArraySubject.DoubleArrayAsIterable
RemovedClass: androidx.kruth.PrimitiveFloatArraySubject.FloatArrayAsIterable:
Removed class androidx.kruth.PrimitiveFloatArraySubject.FloatArrayAsIterable
RemovedClass: androidx.kruth.TableSubject:
Removed class androidx.kruth.TableSubject
RemovedClass: androidx.kruth.Truth:
Expand Down Expand Up @@ -181,6 +181,14 @@ RemovedMethod: androidx.kruth.MapSubject#containsExactly(Object, Object, java.la
Removed method androidx.kruth.MapSubject.containsExactly(Object,Object,java.lang.Object...)
RemovedMethod: androidx.kruth.MapSubject#formattingDiffsUsing(androidx.kruth.Correspondence.DiffFormatter<? super V,? super V>):
Removed method androidx.kruth.MapSubject.formattingDiffsUsing(androidx.kruth.Correspondence.DiffFormatter<? super V,? super V>)
RemovedMethod: androidx.kruth.PrimitiveDoubleArraySubject#usingExactEquality():
Removed method androidx.kruth.PrimitiveDoubleArraySubject.usingExactEquality()
RemovedMethod: androidx.kruth.PrimitiveDoubleArraySubject#usingTolerance(double):
Removed method androidx.kruth.PrimitiveDoubleArraySubject.usingTolerance(double)
RemovedMethod: androidx.kruth.PrimitiveFloatArraySubject#usingExactEquality():
Removed method androidx.kruth.PrimitiveFloatArraySubject.usingExactEquality()
RemovedMethod: androidx.kruth.PrimitiveFloatArraySubject#usingTolerance(double):
Removed method androidx.kruth.PrimitiveFloatArraySubject.usingTolerance(double)
RemovedMethod: androidx.kruth.StandardSubjectBuilder#about(androidx.kruth.CustomSubjectBuilder.Factory<CustomSubjectBuilderT>):
Removed method androidx.kruth.StandardSubjectBuilder.about(androidx.kruth.CustomSubjectBuilder.Factory<CustomSubjectBuilderT>)
RemovedMethod: androidx.kruth.StandardSubjectBuilder#withMessage(String, java.lang.Object...):
Expand Down
76 changes: 74 additions & 2 deletions kruth/kruth/api/current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,24 @@ package androidx.kruth {

public final class KruthKt {
method public static <S extends androidx.kruth.Subject<? extends T>, T> androidx.kruth.SimpleSubjectBuilder<S,T> assertAbout(androidx.kruth.Subject.Factory<? extends S,T> subjectFactory);
method public static androidx.kruth.PrimitiveBooleanArraySubject assertThat(boolean[]? actual);
method public static androidx.kruth.PrimitiveByteArraySubject assertThat(byte[]? actual);
method public static androidx.kruth.PrimitiveCharArraySubject assertThat(char[]? actual);
method public static androidx.kruth.PrimitiveDoubleArraySubject assertThat(double[]? actual);
method public static androidx.kruth.PrimitiveFloatArraySubject assertThat(float[]? actual);
method public static androidx.kruth.PrimitiveIntArraySubject assertThat(int[]? actual);
method public static androidx.kruth.BooleanSubject assertThat(Boolean? actual);
method public static androidx.kruth.DoubleSubject assertThat(Double? actual);
method public static androidx.kruth.IntegerSubject assertThat(Integer? actual);
method public static <T> androidx.kruth.IterableSubject<T> assertThat(Iterable<? extends T>? actual);
method public static androidx.kruth.StringSubject assertThat(String? actual);
method public static <K, V> androidx.kruth.MapSubject<K,V> assertThat(java.util.Map<K,? extends V>? actual);
method public static androidx.kruth.PrimitiveLongArraySubject assertThat(long[]? actual);
method public static androidx.kruth.PrimitiveShortArraySubject assertThat(short[]? actual);
method public static <T extends java.lang.Comparable<? super T>> androidx.kruth.ComparableSubject<T> assertThat(T? actual);
method public static <T> androidx.kruth.Subject<T> assertThat(T? actual);
method public static <T extends java.lang.Throwable> androidx.kruth.ThrowableSubject<T> assertThat(T? actual);
method public static <T> androidx.kruth.ObjectArraySubject<T> assertThat(T![]? actual);
method public static androidx.kruth.StandardSubjectBuilder assertWithMessage(String messageToPrepend);
}

Expand All @@ -142,41 +150,105 @@ package androidx.kruth {
method public void isNotEmpty();
}

public final class ObjectArraySubject<T> extends androidx.kruth.Subject<T[]> {
method public androidx.kruth.IterableSubject<?> asList();
method public void hasLength(int length);
method public void isEmpty();
method public void isNotEmpty();
}

public interface Ordered {
method public void inOrder();
}

public final class PrimitiveBooleanArraySubject extends androidx.kruth.Subject<boolean[]> {
method public androidx.kruth.IterableSubject<java.lang.Boolean> asList();
method public void hasLength(int length);
method public void isEmpty();
method public void isNotEmpty();
}

public final class PrimitiveByteArraySubject extends androidx.kruth.Subject<byte[]> {
method public androidx.kruth.IterableSubject<java.lang.Byte> asList();
method public void hasLength(int length);
method public void isEmpty();
method public void isNotEmpty();
}

public final class PrimitiveCharArraySubject extends androidx.kruth.Subject<char[]> {
method public androidx.kruth.IterableSubject<java.lang.Character> asList();
method public void hasLength(int length);
method public void isEmpty();
method public void isNotEmpty();
}

public final class PrimitiveDoubleArraySubject extends androidx.kruth.Subject<double[]> {
method public androidx.kruth.IterableSubject<java.lang.Double> asList();
method public void hasLength(int length);
method public void isEmpty();
method public void isNotEmpty();
}

public final class PrimitiveFloatArraySubject extends androidx.kruth.Subject<float[]> {
method public androidx.kruth.IterableSubject<java.lang.Float> asList();
method public void hasLength(int length);
method public void isEmpty();
method public void isNotEmpty();
}

public final class PrimitiveIntArraySubject extends androidx.kruth.Subject<int[]> {
method public androidx.kruth.IterableSubject<java.lang.Integer> asList();
method public void hasLength(int length);
method public void isEmpty();
method public void isNotEmpty();
}

public final class PrimitiveLongArraySubject extends androidx.kruth.Subject<long[]> {
method public androidx.kruth.IterableSubject<java.lang.Long> asList();
method public void hasLength(int length);
method public void isEmpty();
method public void isNotEmpty();
}

public final class PrimitiveShortArraySubject extends androidx.kruth.Subject<short[]> {
method public androidx.kruth.IterableSubject<java.lang.Short> asList();
method public void hasLength(int length);
method public void isEmpty();
method public void isNotEmpty();
}

public final class SimpleSubjectBuilder<S extends androidx.kruth.Subject<? extends T>, T> {
method public S that(T actual);
}

public final class StandardSubjectBuilder {
method public <T, S extends androidx.kruth.Subject<? extends T>> androidx.kruth.SimpleSubjectBuilder<S,T> about(androidx.kruth.Subject.Factory<? extends S,T> subjectFactory);
method public Void fail();
method public static androidx.kruth.StandardSubjectBuilder? forCustomFailureStrategy(androidx.kruth.FailureStrategy failureStrategy);
method public static androidx.kruth.StandardSubjectBuilder forCustomFailureStrategy(androidx.kruth.FailureStrategy failureStrategy);
method public androidx.kruth.PrimitiveBooleanArraySubject that(boolean[]? actual);
method public androidx.kruth.PrimitiveByteArraySubject that(byte[]? actual);
method public androidx.kruth.PrimitiveCharArraySubject that(char[]? actual);
method public androidx.kruth.PrimitiveDoubleArraySubject that(double[]? actual);
method public androidx.kruth.PrimitiveFloatArraySubject that(float[]? actual);
method public androidx.kruth.PrimitiveIntArraySubject that(int[]? actual);
method public androidx.kruth.BooleanSubject that(Boolean? actual);
method public androidx.kruth.DoubleSubject that(Double? actual);
method public androidx.kruth.IntegerSubject that(Integer? actual);
method public <T> androidx.kruth.IterableSubject<T> that(Iterable<? extends T>? actual);
method public androidx.kruth.StringSubject that(String? actual);
method public <K, V> androidx.kruth.MapSubject<K,V> that(java.util.Map<K,? extends V>? actual);
method public androidx.kruth.PrimitiveLongArraySubject that(long[]? actual);
method public androidx.kruth.PrimitiveShortArraySubject that(short[]? actual);
method public <T> androidx.kruth.Subject<T> that(T actual);
method public <T extends java.lang.Comparable<? super T>> androidx.kruth.ComparableSubject<T> that(T? actual);
method public <T extends java.lang.Throwable> androidx.kruth.ThrowableSubject<T> that(T? actual);
method public <T> androidx.kruth.ObjectArraySubject<T> that(T![]? actual);
method public androidx.kruth.StandardSubjectBuilder withMessage(String messageToPrepend);
field public static final androidx.kruth.StandardSubjectBuilder.Companion Companion;
}

public static final class StandardSubjectBuilder.Companion {
method public androidx.kruth.StandardSubjectBuilder? forCustomFailureStrategy(androidx.kruth.FailureStrategy failureStrategy);
method public androidx.kruth.StandardSubjectBuilder forCustomFailureStrategy(androidx.kruth.FailureStrategy failureStrategy);
}

public final class StringSubject extends androidx.kruth.ComparableSubject<java.lang.String> {
Expand Down
Loading

0 comments on commit 9720905

Please sign in to comment.