EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.trmk.vcloud_0_8.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [ErrorImpl.java]

nameclass, %method, %block, %line, %
ErrorImpl.java100% (1/1)22%  (2/9)33%  (74/225)41%  (21/51)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ErrorImpl100% (1/1)22%  (2/9)33%  (74/225)41%  (21/51)
getMajorErrorCode (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getMessage (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getMinorErrorCode (): VCloudError$MinorCode 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)
toString (): String 0%   (0/1)0%   (0/32)0%   (0/1)
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)

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

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