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
diff --git a/gerrit-index/src/test/java/com/google/gerrit/index/query/NotPredicateTest.java b/gerrit-index/src/test/java/com/google/gerrit/index/query/NotPredicateTest.java
index 88d8349..74eac61 100644
--- a/gerrit-index/src/test/java/com/google/gerrit/index/query/NotPredicateTest.java
+++ b/gerrit-index/src/test/java/com/google/gerrit/index/query/NotPredicateTest.java
@@ -50,17 +50,26 @@
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) {