Merge branch 'stable-2.14' into stable-2.15

* stable-2.14:
  DeleteDraftPatchSetIT: Only 1 statement should come after ExpectedException#expect
  RevisionIT: Only 1 statement should come after ExpectedException#expect
  NotPredicateTest: Fix misuse of ExpectedException

Change-Id: Ide926569ec5c04f3986fb92741f7d0118104f724
This commit is contained in:
David Pursehouse 2018-07-18 10:30:28 +09:00
commit 1c92bd2398
1 changed files with 18 additions and 9 deletions

View File

@ -50,17 +50,26 @@ public class NotPredicateTest extends PredicateTest {
final TestPredicate p = f("author", "bob");
final Predicate<String> n = not(p);
exception.expect(UnsupportedOperationException.class);
n.getChildren().clear();
assertOnlyChild("clear", p, n);
try {
n.getChildren().clear();
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
assertOnlyChild("clear", p, n);
}
exception.expect(UnsupportedOperationException.class);
n.getChildren().remove(0);
assertOnlyChild("remove(0)", p, n);
try {
n.getChildren().remove(0);
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
assertOnlyChild("remove(0)", p, n);
}
exception.expect(UnsupportedOperationException.class);
n.getChildren().iterator().remove();
assertOnlyChild("remove(0)", p, n);
try {
n.getChildren().iterator().remove();
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
assertOnlyChild("remove()", p, n);
}
}
private static void assertOnlyChild(String o, Predicate<String> c, Predicate<String> p) {