Migrate from is(Not)SameAs to is(Not)SameInstanceAs.

They behave identically, and the old names are being removed.

Open-source note: The new methods are available in Truth as of version 0.44.

END_PUBLIC

More information:
  []

Tested:
    TAP --sample ran all affected tests and none failed
    []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=246550001
This commit is contained in:
cpovirk 2019-05-03 12:02:43 -07:00 committed by jianglai
parent e6e6303b9e
commit 7cb6d23884
4 changed files with 11 additions and 10 deletions

View file

@ -263,7 +263,7 @@ public class ComparatorKeyringTest {
when(secondKeyring.getRdeSigningKey()).thenThrow(new KeyringException("message"));
Keyring comparatorKeyring = ComparatorKeyring.create(actualKeyring, secondKeyring);
assertThat(comparatorKeyring.getRdeSigningKey()).isSameAs(keyPair);
assertThat(comparatorKeyring.getRdeSigningKey()).isSameInstanceAs(keyPair);
assertAboutLogs()
.that(testLogHandler)
@ -300,7 +300,7 @@ public class ComparatorKeyringTest {
when(secondKeyring.getRdeSigningKey()).thenReturn(keyPairCopy);
Keyring comparatorKeyring = ComparatorKeyring.create(actualKeyring, secondKeyring);
assertThat(comparatorKeyring.getRdeSigningKey()).isSameAs(keyPair);
assertThat(comparatorKeyring.getRdeSigningKey()).isSameInstanceAs(keyPair);
assertAboutLogs().that(testLogHandler).hasNoLogsAtLevel(Level.SEVERE);
}
@ -321,7 +321,7 @@ public class ComparatorKeyringTest {
when(secondKeyring.getRdeSigningKey()).thenReturn(keyPairDifferent);
Keyring comparatorKeyring = ComparatorKeyring.create(actualKeyring, secondKeyring);
assertThat(comparatorKeyring.getRdeSigningKey()).isSameAs(keyPair);
assertThat(comparatorKeyring.getRdeSigningKey()).isSameInstanceAs(keyPair);
String alternateKeyPairString = String.format(
"PGPKeyPair{%s, %s}", PUBLIC_KEY_TO_STRING, "PGPPrivateKey{keyId=2}");

View file

@ -148,7 +148,7 @@ public class RdeReportActionTest {
assertThat(response.getPayload()).isEqualTo("OK test 2006-06-06T00:00:00.000Z\n");
// Verify the HTTP request was correct.
assertThat(request.getValue().getMethod()).isSameAs(PUT);
assertThat(request.getValue().getMethod()).isSameInstanceAs(PUT);
assertThat(request.getValue().getURL().getProtocol()).isEqualTo("https");
assertThat(request.getValue().getURL().getPath()).endsWith("/test/20101017001");
Map<String, String> headers = mapifyHeaders(request.getValue().getHeaders());

View file

@ -107,7 +107,7 @@ public final class LockHandlerImplTest {
assertThrows(
RuntimeException.class,
() -> executeWithLocks(new ThrowingCallable(expectedException, clock), lock));
assertThat(exception).isSameAs(expectedException);
assertThat(exception).isSameInstanceAs(expectedException);
verify(lock, times(1)).release();
}
@ -119,7 +119,7 @@ public final class LockHandlerImplTest {
assertThrows(
RuntimeException.class,
() -> executeWithLocks(new ThrowingCallable(expectedException, clock), lock));
assertThat(thrown).hasCauseThat().isSameAs(expectedException);
assertThat(thrown).hasCauseThat().isSameInstanceAs(expectedException);
assertThat(thrown)
.hasMessageThat()
.isEqualTo(
@ -136,7 +136,7 @@ public final class LockHandlerImplTest {
assertThrows(
RuntimeException.class,
() -> executeWithLocks(new ThrowingCallable(expectedException, clock), lock));
assertThat(exception).hasCauseThat().isSameAs(expectedException);
assertThat(exception).hasCauseThat().isSameInstanceAs(expectedException);
verify(lock, times(1)).release();
}

View file

@ -74,7 +74,7 @@ public final class TaskQueueUtilsTest {
@Test
public void testEnqueue_worksOnFirstTry_doesntSleep() {
when(queue.add(ImmutableList.of(task))).thenReturn(ImmutableList.of(handle));
assertThat(taskQueueUtils.enqueue(queue, task)).isSameAs(handle);
assertThat(taskQueueUtils.enqueue(queue, task)).isSameInstanceAs(handle);
verify(queue).add(ImmutableList.of(task));
assertThat(clock.nowUtc()).isEqualTo(DateTime.parse("2000-01-01TZ"));
}
@ -85,7 +85,7 @@ public final class TaskQueueUtilsTest {
.thenThrow(new TransientFailureException(""))
.thenThrow(new TransientFailureException(""))
.thenReturn(ImmutableList.of(handle));
assertThat(taskQueueUtils.enqueue(queue, task)).isSameAs(handle);
assertThat(taskQueueUtils.enqueue(queue, task)).isSameInstanceAs(handle);
verify(queue, times(3)).add(ImmutableList.of(task));
assertThat(clock.nowUtc()).isEqualTo(DateTime.parse("2000-01-01T00:00:00.6Z")); // 200 + 400ms
}
@ -97,7 +97,8 @@ public final class TaskQueueUtilsTest {
ImmutableList<TaskHandle> handles =
ImmutableList.of(new TaskHandle(taskA, "a"), new TaskHandle(taskB, "b"));
when(queue.add(ImmutableList.of(taskA, taskB))).thenReturn(handles);
assertThat(taskQueueUtils.enqueue(queue, ImmutableList.of(taskA, taskB))).isSameAs(handles);
assertThat(taskQueueUtils.enqueue(queue, ImmutableList.of(taskA, taskB)))
.isSameInstanceAs(handles);
assertThat(clock.nowUtc()).isEqualTo(DateTime.parse("2000-01-01TZ"));
}