Skip to content

Commit 6857111

Browse files
committed
fixed bugs in test programs for template builder
1 parent eaf5234 commit 6857111

4 files changed

Lines changed: 41 additions & 23 deletions

File tree

src/test/java/org/msgpack/testclasses/InheritanceClass.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
@Ignore @Message
88
public class InheritanceClass extends SuperClass {
9-
public String f2;
10-
public int f3;
9+
public String f1;
10+
public int f2;
1111

1212
public InheritanceClass() {}
1313

@@ -17,17 +17,24 @@ public boolean equals(Object o) {
1717
return false;
1818
}
1919
InheritanceClass that = (InheritanceClass) o;
20-
// f2
21-
if (f2 == null) {
22-
if (that.f2 != null) {
20+
// f0
21+
if (f0 == null) {
22+
if (that.f0 != null) {
2323
return false;
2424
}
2525
}
26-
if (! f2.equals(that.f2)) {
26+
if (! f0.equals(that.f0)) {
27+
return false;
28+
}
29+
// f1
30+
if (f2 != that.f2) {
2731
return false;
2832
}
29-
// f3
30-
if (f3 != that.f3) {
33+
if (! f1.equals(that.f1)) {
34+
return false;
35+
}
36+
// f2
37+
if (f2 != that.f2) {
3138
return false;
3239
}
3340
return true;

src/test/java/org/msgpack/testclasses/InheritanceClassNotNullable.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77

88
@Ignore @Message
9-
public class InheritanceClassNotNullable extends SuperClass {
9+
public class InheritanceClassNotNullable extends SuperClassNotNullable {
1010
@NotNullable
11-
public String f2;
11+
public String f1;
1212
@NotNullable
13-
public int f3;
13+
public int f2;
1414

1515
public InheritanceClassNotNullable() {}
1616

@@ -20,17 +20,17 @@ public boolean equals(Object o) {
2020
return false;
2121
}
2222
InheritanceClassNotNullable that = (InheritanceClassNotNullable) o;
23-
// f2
24-
if (f2 == null) {
25-
if (that.f2 != null) {
23+
// f1
24+
if (f1 == null) {
25+
if (that.f1 != null) {
2626
return false;
2727
}
2828
}
29-
if (! f2.equals(that.f2)) {
29+
if (! f1.equals(that.f1)) {
3030
return false;
3131
}
32-
// f3
33-
if (f3 != that.f3) {
32+
// f2
33+
if (f2 != that.f2) {
3434
return false;
3535
}
3636
return true;

src/test/java/org/msgpack/testclasses/SuperClass.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
@Ignore @Message
88
public class SuperClass {
99
public String f0;
10-
protected int f1;
1110

1211
public SuperClass() {}
1312

@@ -25,9 +24,6 @@ public boolean equals(Object o) {
2524
if (! f0.equals(that.f0)) {
2625
return false;
2726
}
28-
if (f1 != that.f1) {
29-
return false;
30-
}
3127
return true;
3228
}
3329
}

src/test/java/org/msgpack/testclasses/SuperClassNotNullable.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,23 @@
99
public class SuperClassNotNullable {
1010
@NotNullable
1111
public String f0;
12-
@NotNullable
13-
protected int f1;
1412

1513
public SuperClassNotNullable() {}
14+
15+
@Override
16+
public boolean equals(Object o) {
17+
if (! (o instanceof SuperClassNotNullable)) {
18+
return false;
19+
}
20+
SuperClassNotNullable that = (SuperClassNotNullable) o;
21+
if (f0 == null) {
22+
if (that.f0 != null) {
23+
return false;
24+
}
25+
}
26+
if (! f0.equals(that.f0)) {
27+
return false;
28+
}
29+
return true;
30+
}
1631
}

0 commit comments

Comments
 (0)