Source:
public void removingReviewerTriggersNotification ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.enabled ( ) ) . isTrue ( ) ; com.google.gerrit.extensions.common.AccountInfo acc = new com.google.gerrit.extensions.common.AccountInfo ( "Foo Bar" , "foo.bar@gerritcodereview.com" ) ; for ( com.google.gerrit.extensions.client.ReviewerState state : com.google.common.collect.ImmutableList.of ( ReviewerState.CC , ReviewerState.REVIEWER ) ) { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; com.google.gerrit.extensions.api.changes.AddReviewerInput addInput = new com.google.gerrit.extensions.api.changes.AddReviewerInput ( ) ; addInput.reviewer = com.google.gerrit.acceptance.rest.change.ChangeReviewersByEmailIT.toRFCAddressString ( acc ) ; addInput.state = state ; gApi.changes ( ) . id ( r.getChangeId ( ) ) . addReviewer ( addInput ) ; com.google.gerrit.extensions.api.changes.ReviewInput reviewInput = new com.google.gerrit.extensions.api.changes.ReviewInput ( ) ; reviewInput.message = "I have a comment" ; setApiUser ( user ) ; revision ( r ) . review ( reviewInput ) ; setApiUser ( admin ) ; sender.clear ( ) ; com.google.gerrit.extensions.api.changes.DeleteReviewerByEmailInput deleteReviewerInput = new com.google.gerrit.extensions.api.changes.DeleteReviewerByEmailInput ( ) ; deleteReviewerInput.reviewer = addInput.reviewer ; gApi.changes ( ) . id ( r.getChangeId ( ) ) . deleteReviewerByEmail ( deleteReviewerInput ) ; java.util.List < com.google.gerrit.testutil.FakeEmailSender.Message > messages = sender.getMessages ( ) ; com.google.common.truth.Truth.assertThat ( messages ) . hasSize ( 1 ) ; com.google.common.truth.Truth.assertThat ( messages.get ( 0 ) . rcpt ( ) ) . containsExactly ( com.google.gerrit.server.mail.Address.parse ( addInput.reviewer ) , user.emailAddress ) ; sender.clear ( ) ; } }

Target:
public void removingReviewerTriggersNotification ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.extensions.common.AccountInfo acc = new com.google.gerrit.extensions.common.AccountInfo ( "Foo Bar" , "foo.bar@gerritcodereview.com" ) ; for ( com.google.gerrit.extensions.client.ReviewerState state : com.google.common.collect.ImmutableList.of ( ReviewerState.CC , ReviewerState.REVIEWER ) ) { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; com.google.gerrit.extensions.api.changes.AddReviewerInput addInput = new com.google.gerrit.extensions.api.changes.AddReviewerInput ( ) ; addInput.reviewer = com.google.gerrit.acceptance.rest.change.ChangeReviewersByEmailIT.toRfcAddressString ( acc ) ; addInput.state = state ; gApi.changes ( ) . id ( r.getChangeId ( ) ) . addReviewer ( addInput ) ; com.google.gerrit.extensions.api.changes.ReviewInput reviewInput = new com.google.gerrit.extensions.api.changes.ReviewInput ( ) ; reviewInput.message = "I have a comment" ; setApiUser ( user ) ; revision ( r ) . review ( reviewInput ) ; setApiUser ( admin ) ; sender.clear ( ) ; gApi.changes ( ) . id ( r.getChangeId ( ) ) . reviewer ( addInput.reviewer ) . remove ( ) ; java.util.List < com.google.gerrit.testutil.FakeEmailSender.Message > messages = sender.getMessages ( ) ; com.google.common.truth.Truth.assertThat ( messages ) . hasSize ( 1 ) ; com.google.common.truth.Truth.assertThat ( messages.get ( 0 ) . rcpt ( ) ) . containsExactly ( com.google.gerrit.server.mail.Address.parse ( addInput.reviewer ) , user.emailAddress ) ; sender.clear ( ) ; } }