Browse Source

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>
stable-5.2
David Pursehouse 6 years ago
parent
commit
981e403e59
  1. 3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java

3
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java

@ -46,6 +46,7 @@ package org.eclipse.jgit.transport;
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 class TestProtocolTest {
.setRemote(user1Uri.toString())
.setRefSpecs(MASTER)
.call();
fail("accepted not permitted fetch");
} catch (InvalidRemoteException expected) {
// Expected.
}
@ -282,6 +284,7 @@ public class TestProtocolTest {
.setRemote(user1Uri.toString())
.setRefSpecs(HEADS)
.call();
fail("accepted not permitted push");
} catch (TransportException expected) {
assertTrue(expected.getMessage().contains(
JGitText.get().pushNotPermitted));

Loading…
Cancel
Save