Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -359,7 +359,8 @@ public final U assertValueAt(int index, @NonNull T value) {

T v = values.get(index);
if (!Objects.equals(value, v)) {
throw fail("Values at position " + index + " differ;\nexpected: " + valueAndClass(value) + "\ngot: " + valueAndClass(v));
throw fail("\nexpected: " + valueAndClass(value) + "\ngot: " + valueAndClass(v)
+ "; Value at position " + index + " differ");
}
return (U)this;
}
Expand Down Expand Up @@ -425,7 +426,7 @@ public static String valueAndClass(@Nullable Object o) {
public final U assertValueCount(int count) {
int s = values.size();
if (s != count) {
throw fail("Value counts differ;\nexpected: " + count + "\ngot: " + s);
throw fail("\nexpected: " + count + "\ngot: " + s + "; Value counts differ");
}
return (U)this;
}
Expand All @@ -450,14 +451,15 @@ public final U assertNoValues() {
public final U assertValues(@NonNull T... values) {
int s = this.values.size();
if (s != values.length) {
throw fail("Value count differs;\nexpected: " + values.length + " " + Arrays.toString(values)
+ "\ngot: " + s + " " + this.values);
throw fail("\nexpected: " + values.length + " " + Arrays.toString(values)
+ "\ngot: " + s + " " + this.values + "; Value count differs");
}
for (int i = 0; i < s; i++) {
T v = this.values.get(i);
T u = values[i];
if (!Objects.equals(u, v)) {
throw fail("Values at position " + i + " differ;\nexpected: " + valueAndClass(u) + "\ngot: " + valueAndClass(v));
throw fail("\nexpected: " + valueAndClass(u) + "\ngot: " + valueAndClass(v)
+ "; Value at position " + i + " differ");
}
}
return (U)this;
Expand Down Expand Up @@ -504,7 +506,8 @@ public final U assertValueSequence(@NonNull Iterable<? extends T> sequence) {
T v = actualIterator.next();

if (!Objects.equals(u, v)) {
throw fail("Values at position " + i + " differ;\nexpected: " + valueAndClass(u) + "\ngot: " + valueAndClass(v));
throw fail("\nexpected: " + valueAndClass(u) + "\ngot: " + valueAndClass(v)
+ "; Value at position " + i + " differ");
}
i++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ public void assertValueAtIndexMatch() {

@Test
public void assertValueAtIndexNoMatch() {
assertThrowsWithMessage("Values at position 2 differ;\nexpected: b (class: String)\ngot: c (class: String) (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> {
assertThrowsWithMessage("\nexpected: b (class: String)\ngot: c (class: String); Value at position 2 differ (latch = 0, values = 3, errors = 0, completions = 1)", AssertionError.class, () -> {
TestObserver<String> to = new TestObserver<>();

Observable.just("a", "b", "c").subscribe(to);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ public final U assertErrorMessage(String message) {
Throwable e = errors.get(0);
String errorMessage = e.getMessage();
if (!Objects.equals(message, errorMessage)) {
throw fail("Error message differs;\nexpected: " + message + "\ngot: " + errorMessage);
throw fail("\nexpected: " + message + "\ngot: " + errorMessage
+ "; Error message differs");
}
} else {
throw fail("Multiple errors");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ public final TestObserverEx<T> assertFusionMode(int mode) {
int m = establishedFusionMode;
if (m != mode) {
if (qd != null) {
throw new AssertionError("Fusion mode different.\nexpected: " + fusionModeToString(mode)
+ "\ngot: " + fusionModeToString(m));
throw new AssertionError("\nexpected: " + fusionModeToString(mode)
+ "\ngot: " + fusionModeToString(m) + "; Fusion mode different");
} else {
throw fail("Upstream is not fuseable");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ public final TestSubscriberEx<T> assertFusionMode(int mode) {
int m = establishedFusionMode;
if (m != mode) {
if (qs != null) {
throw new AssertionError("Fusion mode different. Expected: " + fusionModeToString(mode)
+ ", actual: " + fusionModeToString(m));
throw new AssertionError("\nexpected: " + fusionModeToString(mode)
+ "\ngot: " + fusionModeToString(m) + "; Fusion mode different");
} else {
throw fail("Upstream is not fuseable");
}
Expand Down