EMMA Coverage Report (generated Thu Jan 20 11:39:44 EST 2011)
[all classes][com.hammurapi.eventbus.tests.familyties.model]

COVERAGE SUMMARY FOR SOURCE FILE [Person.java]

nameclass, %method, %block, %line, %
Person.java100% (1/1)78%  (7/9)65%  (120/186)55%  (25.9/47)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Person100% (1/1)78%  (7/9)65%  (120/186)55%  (25.9/47)
compareTo (Person): int 0%   (0/1)0%   (0/48)0%   (0/14)
getAge (): int 0%   (0/1)0%   (0/3)0%   (0/1)
equals (Object): boolean 100% (1/1)75%  (38/51)65%  (11/17)
hashCode (): int 100% (1/1)95%  (35/37)98%  (5.9/6)
Person (String, int, boolean): void 100% (1/1)100% (12/12)100% (5/5)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
identity (): String 100% (1/1)100% (2/2)100% (1/1)
isMale (): boolean 100% (1/1)100% (3/3)100% (1/1)
toString (): String 100% (1/1)100% (27/27)100% (1/1)

1/*
2 @license.text@
3 */
4package com.hammurapi.eventbus.tests.familyties.model;
5 
6 
7public class Person implements Comparable<Person> {
8 
9        private String name;
10 
11        private boolean isMale;
12        
13        private int age;
14 
15        public Person(String name, int age, boolean isMale) {
16                super();
17                this.name = name;
18                this.age = age;
19                this.isMale = isMale;
20        }
21 
22        public String toString() {
23                return name + " ["+(isMale ? "male " : "female ")+age+" "+identity()+"]";
24        }
25 
26        private String identity() {
27                return ""; //Integer.toString(System.identityHashCode(this), Character.MAX_RADIX);
28        }
29        
30        @Override
31        public int hashCode() {
32                final int prime = 31;
33                int result = 1;
34                result = prime * result + age;
35                result = prime * result + (isMale ? 1231 : 1237);
36                result = prime * result + ((name == null) ? 0 : name.hashCode());
37                return result;
38        }
39 
40        @Override
41        public boolean equals(Object obj) {
42                if (this == obj) {
43                        return true;
44                }
45                if (obj == null) {
46                        return false;
47                }
48                if (getClass() != obj.getClass()) {
49                        return false;
50                }
51                Person other = (Person) obj;
52                if (age != other.age) {
53                        return false;
54                }
55                if (isMale != other.isMale) {
56                        return false;
57                }
58                if (name == null) {
59                        if (other.name != null) {
60                                return false;
61                        }
62                } else if (!name.equals(other.name)) {
63                        return false;
64                }
65                return true;
66        }
67 
68        public boolean isMale() {
69                return isMale;
70        }
71        
72        public int getAge() {
73                return age;
74        }
75        
76        public String getName() {
77                return name;
78        }
79 
80        @Override
81        public int compareTo(Person o) {
82                if (this==o || this.equals(o)) {
83                        return 0;
84                }
85                
86                int nameCompare = getName().compareTo(o.getName());
87                if (nameCompare!=0) {
88                        return nameCompare;
89                }
90                
91                int ageCompare = getAge() - o.getAge();
92                
93                if (ageCompare!=0) {
94                        return ageCompare;
95                }
96                                
97                if (isMale()) {
98                        if (!o.isMale()) {
99                                return -1;
100                        }
101                } else {
102                        if (o.isMale()) {
103                                return 1;
104                        }
105                }
106                return hashCode()- o.hashCode();
107        }
108 
109        
110}

[all classes][com.hammurapi.eventbus.tests.familyties.model]
EMMA 2.0.5312 EclEmma Fix 2 (C) Vladimir Roubtsov