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 @@ -18,6 +18,7 @@

import static com.google.cloud.spanner.Type.StructField;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static org.junit.Assert.fail;
import static org.junit.runners.Parameterized.Parameter;

Expand Down Expand Up @@ -352,17 +353,17 @@ public void getterForIncorrectType() throws Exception {
getterByIndex(method.getName(), columnIndex);
fail("Expected ISE for " + method);
} catch (IllegalStateException e) {
assertThat(e.getMessage()).named("Exception for " + method).contains("was " + type);
assertThat(e.getMessage())
.named("Exception for " + method)
assertWithMessage("Exception for " + method).that(e.getMessage()).contains("was " + type);
assertWithMessage("Exception for " + method)
.that(e.getMessage())
.contains("Column " + columnIndex);
}
try {
getterByName(method.getName(), "F1");
fail("Expected ISE for " + method);
} catch (IllegalStateException e) {
assertThat(e.getMessage()).named("Exception for " + method).contains("was " + type);
assertThat(e.getMessage()).named("Exception for " + method).contains("Column F1");
assertWithMessage("Exception for " + method).that(e.getMessage()).contains("was " + type);
assertWithMessage("Exception for " + method).that(e.getMessage()).contains("Column F1");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.common.testing.SerializableTester.reserializeAndAssert;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;

import com.google.cloud.Timestamp;
import com.google.cloud.spanner.TimestampBound.Mode;
Expand Down Expand Up @@ -110,8 +111,8 @@ public void stalenessSourceUnits() {
long num = 7;
for (TimeUnit units : TimeUnit.values()) {
TimestampBound bound = TimestampBound.ofExactStaleness(num, units);
assertThat(bound.getExactStaleness(TimeUnit.NANOSECONDS))
.named(units.toString())
assertWithMessage(units.toString())
.that(bound.getExactStaleness(TimeUnit.NANOSECONDS))
.isEqualTo(units.toNanos(num));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.cloud.spanner;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;

import com.google.cloud.ByteArray;
import com.google.cloud.Date;
Expand Down Expand Up @@ -54,7 +55,7 @@ public void reflection() throws InvocationTargetException, IllegalAccessExceptio
continue;
}
Method binderMethod = findBinderMethod(method);
assertThat(binderMethod).named("Binder for " + method.toString()).isNotNull();
assertWithMessage("Binder for " + method.toString()).that(binderMethod).isNotNull();

if (method.getName().toLowerCase().contains("struct")) {
// Struct / Array-of-struct binding methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.common.testing.SerializableTester.reserializeAndAssert;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;

import com.google.cloud.ByteArray;
import com.google.cloud.Date;
Expand Down Expand Up @@ -359,8 +360,8 @@ public void boolArrayFromPlainIterable() {
}
String name = "boolArray() of length " + i;
Value v = Value.boolArray(plainIterable(data));
assertThat(v.isNull()).named(name).isFalse();
assertThat(v.getBoolArray()).named(name).containsExactly((Object[]) data).inOrder();
assertWithMessage(name).that(v.isNull()).isFalse();
assertWithMessage(name).that(v.getBoolArray()).containsExactly((Object[]) data).inOrder();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static com.google.cloud.spanner.SpannerMatchers.isSpannerException;
import static com.google.cloud.spanner.Type.StructField;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;

import com.google.cloud.spanner.Database;
import com.google.cloud.spanner.DatabaseClient;
Expand Down Expand Up @@ -426,7 +427,7 @@ private void checkReadRange(Source source, KeySet keySet, long limit, int[] expe
rows.put(resultSet.getString(0), resultSet.getString(1));
}

assertThat(rows).named("read of " + keySet).isEqualTo(expected);
assertWithMessage("read of " + keySet).that(rows).isEqualTo(expected);
}

private void checkRange(Source source, KeyRange range, int... expectedRows) {
Expand Down