ReviewDelegator extends BaseDelegator implements IReviewDelegator { @Override public List<IReviewChangelist> getReviewChangelists(final GetReviewChangelistsOptions opts) throws P4JavaException { List<IReviewChangelist> reviewList = new ArrayList<>(); List<Map<String, Object>> resultMaps = execMapCmdList( REVIEW, processParameters(opts, server), null); if (nonNull(resultMaps)) { for (Map<String, Object> map : resultMaps) { handleErrorStr(map); try { ReviewChangelist reviewChangelist = new ReviewChangelist( parseInt(map, "change"), parseString(map, "user"), parseString(map, "email"), parseString(map, "name")); reviewList.add(reviewChangelist); } catch (Throwable thr) { Log.error("Unexpected exception in getReviews: %s", thr.getLocalizedMessage()); Log.exception(thr); } } } return reviewList; } ReviewDelegator(IOptionsServer server); @Override List<IReviewChangelist> getReviewChangelists(final GetReviewChangelistsOptions opts);  }
@Test public void shouldThrowsExceptionWhenInnerMethodCallThrowsIt() throws Exception { thrown.expect(AccessException.class); doThrow(AccessException.AccessExceptionForTests.class).when(server) .execMapCmdList(eq(REVIEW.toString()), eq(CMD_ARGUMENTS), eq(null)); reviewDelegator.getReviewChangelists(opts); }
@Test public void shouldThrowsExceptionWhenInnerMethodCallThrowsIt() throws Exception { thrown.expect(AccessException.class); doThrow(AccessException.class).when(server).execMapCmdList(eq(REVIEW.toString()), eq(CMD_ARGUMENTS), eq((Map<String, Object>) null)); reviewDelegator.getReviewChangelists(opts); }
@Test public void shouldThrowsExceptionWhenInnerMethodCallThrowsIt() throws Exception { thrown.expect(AccessException.class); doThrow(AccessException.class).when(server) .execMapCmdList(eq(REVIEW.toString()), eq(CMD_ARGUMENTS), eq(null)); reviewDelegator.getReviewChangelists(opts); }