Coverage Report - org.eclipse.swtbot.swt.finder.utils.Credentials
 
Classes in this File Line Coverage Branch Coverage Complexity
Credentials
75%
21/28
77%
17/22
4.6
 
 1  
 /*******************************************************************************
 2  
  * Copyright (c) 2010 Ketan Padegaonkar and others.
 3  
  * All rights reserved. This program and the accompanying materials
 4  
  * are made available under the terms of the Eclipse Public License v1.0
 5  
  * which accompanies this distribution, and is available at
 6  
  * http://www.eclipse.org/legal/epl-v10.html
 7  
  * 
 8  
  * Contributors:
 9  
  *     Ketan Padegaonkar - initial API and implementation
 10  
  *******************************************************************************/
 11  
 package org.eclipse.swtbot.swt.finder.utils;
 12  
 
 13  
 /**
 14  
  * @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>
 15  
  */
 16  
 public class Credentials {
 17  
 
 18  
         private final String        username;
 19  
         private final String        password;
 20  
 
 21  24
         public Credentials(String username, String password) {
 22  24
                 this.username = username;
 23  24
                 this.password = password;
 24  24
         }
 25  
 
 26  
         public String username() {
 27  0
                 return username;
 28  
         }
 29  
 
 30  
         public String password() {
 31  0
                 return password;
 32  
         }
 33  
 
 34  
         @Override
 35  
         public int hashCode() {
 36  
                 final int prime = 31;
 37  12
                 int result = 1;
 38  12
                 result = prime * result + ((password == null) ? 0 : password.hashCode());
 39  12
                 result = prime * result + ((username == null) ? 0 : username.hashCode());
 40  12
                 return result;
 41  
         }
 42  
 
 43  
         @Override
 44  
         public boolean equals(Object obj) {
 45  6
                 if (this == obj)
 46  0
                         return true;
 47  6
                 if (obj == null)
 48  0
                         return false;
 49  6
                 if (getClass() != obj.getClass())
 50  0
                         return false;
 51  6
                 Credentials other = (Credentials) obj;
 52  6
                 if (password == null) {
 53  3
                         if (other.password != null)
 54  1
                                 return false;
 55  3
                 } else if (!password.equals(other.password))
 56  0
                         return false;
 57  5
                 if (username == null) {
 58  3
                         if (other.username != null)
 59  1
                                 return false;
 60  2
                 } else if (!username.equals(other.username))
 61  0
                         return false;
 62  4
                 return true;
 63  
         }
 64  
 
 65  
 }