Clover coverage report - Acegi Security System for Spring - 1.0.0-RC1
Coverage timestamp: Mon Dec 5 2005 09:05:15 EST
file stats: LOC: 52   Methods: 3
NCLOC: 19   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
MockAuthenticationManager.java 100% 100% 100% 100%
coverage
 1    /* Copyright 2004 Acegi Technology Pty Limited
 2    *
 3    * Licensed under the Apache License, Version 2.0 (the "License");
 4    * you may not use this file except in compliance with the License.
 5    * You may obtain a copy of the License at
 6    *
 7    * http://www.apache.org/licenses/LICENSE-2.0
 8    *
 9    * Unless required by applicable law or agreed to in writing, software
 10    * distributed under the License is distributed on an "AS IS" BASIS,
 11    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12    * See the License for the specific language governing permissions and
 13    * limitations under the License.
 14    */
 15   
 16    package org.acegisecurity;
 17   
 18    /**
 19    * Simply accepts as valid whatever is passed to it, if
 20    * <code>grantAccess</code> is set to <code>true</code>.
 21    *
 22    * @author Ben Alex
 23    * @author Wesley Hall
 24    * @version $Id: MockAuthenticationManager.java,v 1.2 2005/11/17 00:55:49 benalex Exp $
 25    */
 26    public class MockAuthenticationManager extends AbstractAuthenticationManager {
 27    //~ Instance fields ========================================================
 28   
 29    private boolean grantAccess = true;
 30   
 31    //~ Constructors ===========================================================
 32   
 33  16 public MockAuthenticationManager(boolean grantAccess) {
 34  16 this.grantAccess = grantAccess;
 35    }
 36   
 37  37 public MockAuthenticationManager() {
 38  37 super();
 39    }
 40   
 41    //~ Methods ================================================================
 42   
 43  15 public Authentication doAuthentication(Authentication authentication)
 44    throws AuthenticationException {
 45  15 if (grantAccess) {
 46  11 return authentication;
 47    } else {
 48  4 throw new BadCredentialsException(
 49    "MockAuthenticationManager instructed to deny access");
 50    }
 51    }
 52    }