TestProtocolTest: Add missing calls to fail()

Error Prone reports:

  Not calling fail() when expecting an exception masks bugs

See https://errorprone.info/bugpattern/MissingFail

Change-Id: I58ad45a87dcf7d646dce056d20776d62faafbfef
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2018-09-29 13:20:02 +09:00
parent 0b292b9085
commit 981e403e59
1 changed files with 3 additions and 0 deletions

View File

@ -46,6 +46,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.List;
@ -238,6 +239,7 @@ public UploadPack create(User req, Repository db)
.setRemote(user1Uri.toString())
.setRefSpecs(MASTER)
.call();
fail("accepted not permitted fetch");
} catch (InvalidRemoteException expected) {
// Expected.
}
@ -282,6 +284,7 @@ public ReceivePack create(User req, Repository db)
.setRemote(user1Uri.toString())
.setRefSpecs(HEADS)
.call();
fail("accepted not permitted push");
} catch (TransportException expected) {
assertTrue(expected.getMessage().contains(
JGitText.get().pushNotPermitted));