Skip to content

Package: Animal

Animal

nameinstructionbranchcomplexitylinemethod
Animal()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
Animal(int, String, float, boolean)
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
equals(Object)
M: 51 C: 0
0%
M: 14 C: 0
0%
M: 8 C: 0
0%
M: 12 C: 0
0%
M: 1 C: 0
0%
getAge()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getName()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getWeight()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
hashCode()
M: 44 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
isFurry()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setAge(int)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setFurry(boolean)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setName(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setWeight(float)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: /*
18: * $Id$
19: */
20:
21: package ee.jakarta.tck.json.bind.customizedmapping.adapters.model;
22:
23: public class Animal {
24: private int age;
25:
26: private String name;
27:
28: private float weight;
29:
30: private boolean furry;
31:
32: public Animal() {
33: }
34:
35: public Animal(int age, String name, float weight, boolean furry) {
36: this.age = age;
37: this.name = name;
38: this.weight = weight;
39: this.furry = furry;
40: }
41:
42: public int getAge() {
43: return age;
44: }
45:
46: public void setAge(int age) {
47: this.age = age;
48: }
49:
50: public String getName() {
51: return name;
52: }
53:
54: public void setName(String name) {
55: this.name = name;
56: }
57:
58: public float getWeight() {
59: return weight;
60: }
61:
62: public void setWeight(float weight) {
63: this.weight = weight;
64: }
65:
66: public boolean isFurry() {
67: return furry;
68: }
69:
70: public void setFurry(boolean furry) {
71: this.furry = furry;
72: }
73:
74: @Override
75: public boolean equals(Object o) {
76:• if (this == o) {
77: return true;
78: }
79:• if (!(o instanceof Animal)) {
80: return false;
81: }
82:
83: Animal animal = (Animal) o;
84:
85:• if (age != animal.age) {
86: return false;
87: }
88:• if (Float.compare(animal.weight, weight) != 0) {
89: return false;
90: }
91:• if (furry != animal.furry) {
92: return false;
93: }
94:• return name != null ? name.equals(animal.name) : animal.name == null;
95: }
96:
97: @Override
98: public int hashCode() {
99: int result = age;
100:• result = 31 * result + (name != null ? name.hashCode() : 0);
101:• result = 31 * result + (weight != +0.0f ? Float.floatToIntBits(weight) : 0);
102:• result = 31 * result + (furry ? 1 : 0);
103: return result;
104: }
105: }