@Before
 public void setup() throws Exception {
   securityService = context.mock(SecurityService.class);
   permissionInterceptor = new AuthorizationInterceptor(securityService);
   request = new MockHttpServletRequest();
   response = new MockHttpServletResponse();
 }
 private void assumeUserHasOperatePermissionForPipeline() {
   context.checking(
       new Expectations() {
         {
           one(securityService).hasOperatePermissionForPipeline(ANONYMOUS.getUsername(), "cruise");
           will(returnValue(true));
         }
       });
 }
 private void assumeUserHasOperatePermissionForFirstStage() {
   context.checking(
       new Expectations() {
         {
           one(securityService)
               .hasOperatePermissionForFirstStage(
                   "cruise", CaseInsensitiveString.str(ANONYMOUS.getUsername()));
           will(returnValue(true));
         }
       });
 }
 private void assumeUserHasViewPermission() {
   context.checking(
       new Expectations() {
         {
           one(securityService)
               .hasViewPermissionForPipeline(
                   CaseInsensitiveString.str(ANONYMOUS.getUsername()), "cruise");
           will(returnValue(true));
         }
       });
 }