private void setupStandardMocks() throws Exception { Map<String, List<String>> externalGroups = new HashMap<>(); externalGroups.put( EzSecurityConstant.EZ_INTERNAL_PROJECT, Lists.newArrayList(EzSecurityConstant.EZ_INTERNAL_ADMIN_GROUP)); EzSecurityPrincipal principal = new EzSecurityPrincipal(); principal.setPrincipal(POC).setName(POC); expect( mockPool.getClient( InternalNameServiceConstants.SERVICE_NAME, InternalNameService.Client.class)) .andReturn(insClientMock) .anyTimes(); expect( mockPool.getClient( EzSecurityRegistrationConstants.SERVICE_NAME, EzSecurityRegistration.Client.class)) .andReturn(regClientMock) .anyTimes(); expect(mockPool.getSecurityId(EzSecurityRegistrationConstants.SERVICE_NAME)) .andReturn("") .anyTimes(); expect(mockPool.getSecurityId(EzDeployServiceConstants.SERVICE_NAME)).andReturn("").anyTimes(); expect(securityClientMock.fetchTokenForProxiedUser()).andReturn(ezTokenMock).anyTimes(); expect(securityClientMock.fetchTokenForProxiedUser("")).andReturn(ezTokenMock).anyTimes(); expect(insClientMock.getAppById("48454c4c4f-20-574f524c44", ezTokenMock)) .andReturn(getApplication()); expect(ezTokenMock.getExternalProjectGroups()).andReturn(externalGroups).anyTimes(); expect(ezTokenMock.getTokenPrincipal()).andReturn(principal).anyTimes(); mockPool.returnToPool(insClientMock); expectLastCall().anyTimes(); mockPool.returnToPool(regClientMock); expectLastCall().anyTimes(); }