EMMA Coverage Report (generated Fri Aug 26 14:14:05 EDT 2011)
[all classes][org.jclouds.vcloud.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [ErrorImpl.java]

nameclass, %method, %block, %line, %
ErrorImpl.java100% (1/1)56%  (5/9)50%  (112/225)47%  (24/51)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ErrorImpl100% (1/1)56%  (5/9)50%  (112/225)47%  (24/51)
getMajorErrorCode (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getStackTrace (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getVendorSpecificErrorCode (): String 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/65)0%   (0/8)
equals (Object): boolean 100% (1/1)58%  (53/92)47%  (14/30)
ErrorImpl (String, int, VCloudError$MinorCode, String, String): void 100% (1/1)100% (21/21)100% (7/7)
getMessage (): String 100% (1/1)100% (3/3)100% (1/1)
getMinorErrorCode (): VCloudError$MinorCode 100% (1/1)100% (3/3)100% (1/1)
toString (): String 100% (1/1)100% (32/32)100% (1/1)

1/**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
18 */
19package org.jclouds.vcloud.domain.internal;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import javax.annotation.Nullable;
24 
25import org.jclouds.vcloud.domain.VCloudError;
26 
27/**
28 * 
29 * @author Adrian Cole
30 * 
31 */
32public class ErrorImpl implements VCloudError {
33   private final String message;
34   private final int majorErrorCode;
35   private final MinorCode minorErrorCode;
36   @Nullable
37   private final String vendorSpecificErrorCode;
38   @Nullable
39   private final String stackTrace;
40 
41   public ErrorImpl(String message, int majorErrorCode, @Nullable MinorCode minorErrorCode,
42            @Nullable String vendorSpecificErrorCode, @Nullable String stackTrace) {
43      this.message = checkNotNull(message, "message");
44      this.majorErrorCode = majorErrorCode;
45      this.minorErrorCode = minorErrorCode; // check null after 0.8 is gone
46      this.vendorSpecificErrorCode = vendorSpecificErrorCode;
47      this.stackTrace = stackTrace;
48   }
49 
50   public String getMessage() {
51      return message;
52   }
53 
54   public int getMajorErrorCode() {
55      return majorErrorCode;
56   }
57 
58   public MinorCode getMinorErrorCode() {
59      return minorErrorCode;
60   }
61 
62   public String getVendorSpecificErrorCode() {
63      return vendorSpecificErrorCode;
64   }
65 
66   public String getStackTrace() {
67      return stackTrace;
68   }
69 
70   @Override
71   public int hashCode() {
72      final int prime = 31;
73      int result = 1;
74      result = prime * result + majorErrorCode;
75      result = prime * result + ((message == null) ? 0 : message.hashCode());
76      result = prime * result + ((minorErrorCode == null) ? 0 : minorErrorCode.hashCode());
77      result = prime * result + ((stackTrace == null) ? 0 : stackTrace.hashCode());
78      result = prime * result + ((vendorSpecificErrorCode == null) ? 0 : vendorSpecificErrorCode.hashCode());
79      return result;
80   }
81 
82   @Override
83   public boolean equals(Object obj) {
84      if (this == obj)
85         return true;
86      if (obj == null)
87         return false;
88      if (getClass() != obj.getClass())
89         return false;
90      ErrorImpl other = (ErrorImpl) obj;
91      if (majorErrorCode != other.majorErrorCode)
92         return false;
93      if (message == null) {
94         if (other.message != null)
95            return false;
96      } else if (!message.equals(other.message))
97         return false;
98      if (minorErrorCode == null) {
99         if (other.minorErrorCode != null)
100            return false;
101      } else if (!minorErrorCode.equals(other.minorErrorCode))
102         return false;
103      if (stackTrace == null) {
104         if (other.stackTrace != null)
105            return false;
106      } else if (!stackTrace.equals(other.stackTrace))
107         return false;
108      if (vendorSpecificErrorCode == null) {
109         if (other.vendorSpecificErrorCode != null)
110            return false;
111      } else if (!vendorSpecificErrorCode.equals(other.vendorSpecificErrorCode))
112         return false;
113      return true;
114   }
115 
116   @Override
117   public String toString() {
118      return "[majorErrorCode=" + majorErrorCode + ", message=" + message + ", minorErrorCode=" + minorErrorCode
119               + ", stackTrace=" + stackTrace + ", vendorSpecificErrorCode=" + vendorSpecificErrorCode + "]";
120   }
121 
122}

[all classes][org.jclouds.vcloud.domain.internal]
EMMA 2.0.5312 (C) Vladimir Roubtsov