Fix tests assertions that compared incompatible types
We wrongly suppressed warnings for these assertions by using
@SuppressWarnings("TruthIncompatibleType"). Instead we should fix the
bad assertions.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ia68f476048a97ee6c5281d7c8b80581295bd7c68
This commit is contained in:
@@ -82,17 +82,14 @@ public class PushPermissionsIT extends AbstractDaemonTest {
|
||||
.update();
|
||||
}
|
||||
|
||||
@SuppressWarnings("TruthIncompatibleType")
|
||||
@Test
|
||||
public void mixingMagicAndRegularPush() throws Exception {
|
||||
testRepo.branch("HEAD").commit().create();
|
||||
PushResult r = push("HEAD:refs/heads/master", "HEAD:refs/for/master");
|
||||
|
||||
String msg = "cannot combine normal pushes and magic pushes";
|
||||
assertThat(r.getRemoteUpdate("refs/heads/master"))
|
||||
.isNotEqualTo(/* expected: RemoteRefUpdate, actual: Status */ Status.OK);
|
||||
assertThat(r.getRemoteUpdate("refs/for/master"))
|
||||
.isNotEqualTo(/* expected: RemoteRefUpdate, actual: Status */ Status.OK);
|
||||
assertThat(r.getRemoteUpdate("refs/heads/master").getStatus()).isNotEqualTo(Status.OK);
|
||||
assertThat(r.getRemoteUpdate("refs/for/master").getStatus()).isNotEqualTo(Status.OK);
|
||||
assertThat(r.getRemoteUpdate("refs/for/master").getMessage()).isEqualTo(msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.google.gerrit.server.CommentsUtil;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -33,7 +34,6 @@ import org.junit.runners.JUnit4;
|
||||
@RunWith(JUnit4.class)
|
||||
public class ListChangeCommentsTest {
|
||||
|
||||
@SuppressWarnings("TruthIncompatibleType")
|
||||
@Test
|
||||
public void commentsLinkedToChangeMessagesIgnoreGerritAutoGenTaggedMessages() {
|
||||
/* Comments should not be linked to Gerrit's autogenerated messages */
|
||||
@@ -55,10 +55,10 @@ public class ListChangeCommentsTest {
|
||||
.isEqualTo(getChangeMessage(changeMessages, "cm3").getKey().uuid());
|
||||
|
||||
// Make sure no comment is linked to the auto-gen message
|
||||
assertThat(comments.stream().map(c -> c.changeMessageId).collect(Collectors.toSet()))
|
||||
.doesNotContain(
|
||||
/* expected: String, actual: ChangeMessage */ getChangeMessage(
|
||||
changeMessages, "cmAutoGenByGerrit"));
|
||||
Set<String> changeMessageIds =
|
||||
comments.stream().map(c -> c.changeMessageId).collect(Collectors.toSet());
|
||||
assertThat(changeMessageIds)
|
||||
.doesNotContain(getChangeMessage(changeMessages, "cmAutoGenByGerrit").getKey().uuid());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user