Skip to content

Commit f12cd41

Browse files
committed
More test fixes to help with Eclipse
1 parent 3704683 commit f12cd41

14 files changed

+59
-55
lines changed

protobuf/src/test/java/tools/jackson/dataformat/protobuf/BigNumPair.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

protobuf/src/test/java/tools/jackson/dataformat/protobuf/EnumHandlingTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@
1414

1515
public class EnumHandlingTest extends ProtobufTestBase
1616
{
17-
enum TinyEnum {
17+
public enum TinyEnum {
1818
X;
1919
}
2020

21-
enum BigEnum {
21+
public enum BigEnum {
2222
A, B, C, D, E,
2323
F, G, H, I, J;
2424
}
2525

26-
static class TinyEnumWrapper {
26+
public static class TinyEnumWrapper {
2727
public TinyEnum value;
2828

29-
TinyEnumWrapper() { }
29+
public TinyEnumWrapper() { }
3030
public TinyEnumWrapper(TinyEnum v) { value = v; }
3131
}
3232

33-
static class BigEnumWrapper {
33+
public static class BigEnumWrapper {
3434
public BigEnum value;
3535

36-
BigEnumWrapper() { }
36+
public BigEnumWrapper() { }
3737
public BigEnumWrapper(BigEnum v) { value = v; }
3838
}
3939

@@ -43,7 +43,7 @@ static class BigEnumWrapper {
4343
/**********************************************************
4444
*/
4545

46-
final ProtobufMapper MAPPER = new ProtobufMapper();
46+
final ProtobufMapper MAPPER = newObjectMapper();
4747

4848
@Test
4949
public void testBigEnum() throws Exception

protobuf/src/test/java/tools/jackson/dataformat/protobuf/NextXxxParsingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ public class NextXxxParsingTest extends ProtobufTestBase
2222
+"}\n"
2323
;
2424

25-
static class Strings {
25+
public static class Strings {
2626
public String[] values;
2727

2828
public Strings() { }
2929
public Strings(String... v) { values = v; }
3030
}
3131

32-
final ObjectMapper MAPPER = new ObjectMapper(new ProtobufFactory());
32+
final ObjectMapper MAPPER = newObjectMapper();
3333

3434
@Test
3535
public void testNextFieldAndText() throws Exception

protobuf/src/test/java/tools/jackson/dataformat/protobuf/ProtobufTestBase.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public boolean equals(Object o) {
180180
public static class Point3 {
181181
public int x, y, z;
182182

183-
protected Point3() { }
183+
public Point3() { }
184184

185185
public Point3(int x, int y, int z) {
186186
this.x = x;
@@ -206,7 +206,7 @@ public static class PointL {
206206
public long x;
207207
public long y;
208208

209-
protected PointL() { }
209+
public PointL() { }
210210

211211
public PointL(long x, long y) {
212212
this.x = x;
@@ -231,7 +231,7 @@ public static class OptionalValue {
231231
public boolean present;
232232
public String value;
233233

234-
protected OptionalValue() { }
234+
public OptionalValue() { }
235235
public OptionalValue(boolean p, String v) {
236236
present = p;
237237
value = v;
@@ -259,7 +259,7 @@ public static class PointD {
259259
public double x;
260260
public double y;
261261

262-
protected PointD() { }
262+
public PointD() { }
263263

264264
public PointD(double x, double y) {
265265
this.x = x;

protobuf/src/test/java/tools/jackson/dataformat/protobuf/ReadUnknownFields202Test.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
public class ReadUnknownFields202Test extends ProtobufTestBase
1717
{
1818
// [dataformats-binary#202]
19-
static class TestMessageV0
19+
public static class TestMessageV0
2020
{
2121
@JsonProperty(required = true, index = 1)
22-
private String id;
22+
protected String id;
2323
@JsonProperty(required = false, index = 2)
24-
private String plant;
24+
protected String plant;
2525

2626
public TestMessageV0() { }
2727

@@ -39,20 +39,20 @@ public String getPlant() {
3939
}
4040
}
4141

42-
static class TestMessageV1
42+
public static class TestMessageV1
4343
{
4444
@JsonProperty(required = true, index = 1)
45-
private String id;
45+
protected String id;
4646
@JsonProperty(required = false, index = 2)
47-
private String plant;
47+
protected String plant;
4848
@JsonProperty(required = false, index = 3)
49-
private Double length;
49+
protected Double length;
5050
@JsonProperty(required = false, index = 4)
51-
private Double width;
51+
protected Double width;
5252
@JsonProperty(required = false, index = 5)
53-
private String descr;
53+
protected String descr;
5454
@JsonProperty(required = false, index = 6)
55-
private String source;
55+
protected String source;
5656

5757
public TestMessageV1() { }
5858

protobuf/src/test/java/tools/jackson/dataformat/protobuf/ReadUnkownFieldsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313
public class ReadUnkownFieldsTest extends ProtobufTestBase
1414
{
15-
static class OneField {
15+
public static class OneField {
1616
@JsonProperty(value = "f3", index = 3)
1717
public int f3;
1818
}
1919

20-
static class ThreeField {
20+
public static class ThreeField {
2121

2222
@JsonProperty(value = "f1", index = 1)
2323
private int f1;

protobuf/src/test/java/tools/jackson/dataformat/protobuf/RoundtripNestedMessageTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class RoundtripNestedMessageTest extends ProtobufTestBase
3636
"optional string a = 1;\n" + //
3737
"}\n"; //
3838

39-
static class TestObject {
39+
public static class TestObject {
4040
String a;
4141
TestSub b;
4242

@@ -59,7 +59,7 @@ public void setB(TestSub b) {
5959

6060
// ordering would be needed prior to fix for [#59]
6161
//@com.fasterxml.jackson.annotation.JsonPropertyOrder({"d", "b", "c"})
62-
static class TestSub {
62+
public static class TestSub {
6363
String b;
6464
String c;
6565
TestSubSub d;
@@ -103,7 +103,7 @@ public void setA(String a) {
103103

104104
// [dataformats-binary#135]: endless END_OBJECT at end of doc
105105
@JsonPropertyOrder({ "name", "age", "emails", "boss" })
106-
static class Employee135 {
106+
public static class Employee135 {
107107
public int age;
108108

109109
public String[] emails;

protobuf/src/test/java/tools/jackson/dataformat/protobuf/SerDeserLongTest.java

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

77
import org.junit.jupiter.api.Test;
88

9+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
10+
11+
import static org.junit.jupiter.api.Assertions.assertEquals;
12+
913
public class SerDeserLongTest extends ProtobufTestBase
1014
{
15+
@JsonPropertyOrder({ "long1", "long2" })
16+
public static class BigNumPair {
17+
public static final String protobuf_str =
18+
"message BigNumPair {\n"
19+
+ " required int64 long1 = 1;\n"
20+
+ " required int64 long2 = 2;\n"
21+
+ "}\n";
22+
23+
public long long1;
24+
public long long2;
25+
}
26+
1127
@Test
1228
public void testWeirdLongSerDeser() throws Exception {
1329
ObjectMapper mapper = newObjectMapper();
@@ -21,7 +37,7 @@ public void testWeirdLongSerDeser() throws Exception {
2137

2238
BigNumPair parsed = mapper.readerFor(BigNumPair.class).with(schema).readValue(encoded);
2339

24-
assert parsed.long1 == bnp.long1;
25-
assert parsed.long2 == bnp.long2;
40+
assertEquals(bnp.long1, parsed.long1);
41+
assertEquals(bnp.long2, parsed.long2);
2642
}
2743
}

protobuf/src/test/java/tools/jackson/dataformat/protobuf/WriteArrayTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ public class WriteArrayTest extends ProtobufTestBase
3535
+PROTOC_POINT;
3636
;
3737

38-
static class StringArray {
38+
public static class StringArray {
3939
public String[] values;
4040

4141
public StringArray(String... v) {
4242
values = v;
4343
}
4444
}
4545

46-
static class PointArray {
46+
public static class PointArray {
4747
public Point[] points;
4848

4949
public PointArray(Point... p) {
5050
points = p;
5151
}
5252
}
5353

54-
final ObjectMapper MAPPER = new ObjectMapper(new ProtobufFactory());
54+
private final ObjectMapper MAPPER = newObjectMapper();
5555

5656
final ProtobufSchema SPARSE_STRING_SCHEMA;
5757
final ProtobufSchema PACKED_STRING_SCHEMA;

protobuf/src/test/java/tools/jackson/dataformat/protobuf/WriteAsMapTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void testWriteAsMap() throws Exception
5757
phone2.put("number", "654321");
5858
phones.add(phone2);
5959

60-
Map<String,Object> person = new LinkedHashMap<String,Object>(); // it is ok if using HashMap.
60+
Map<String,Object> person = new LinkedHashMap<>(); // it is ok if using HashMap.
6161
person.put("id", 1111);
6262
person.put("name", "aaaa");
6363
person.put("phone", phones);

protobuf/src/test/java/tools/jackson/dataformat/protobuf/WriteBigArrayTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public WriteBigArrayTest() throws Exception {
4040
PACKED_STRING_SCHEMA = ProtobufSchemaLoader.std.parse(PROTOC_STRING_ARRAY_PACKED);
4141
}
4242

43-
static class StringArray {
43+
public static class StringArray {
4444
public String[] values;
4545

4646
public StringArray() { }
@@ -51,7 +51,7 @@ public StringArray(List<String> v) {
5151
public int size() { return values.length; }
5252
}
5353

54-
static class StringArrayWrapper
54+
public static class StringArrayWrapper
5555
{
5656
public StringArray values;
5757

protobuf/src/test/java/tools/jackson/dataformat/protobuf/WriteBinaryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class WriteBinaryTest extends ProtobufTestBase
2424
;
2525

2626
@JsonPropertyOrder({ "id", "trailer", "data"})
27-
static class Binary {
27+
public static class Binary {
2828
public int id, trailer;
2929
public byte[] data;
3030

protobuf/src/test/java/tools/jackson/dataformat/protobuf/WriteErrorsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
*/
2222
public class WriteErrorsTest extends ProtobufTestBase
2323
{
24-
static class Point3D extends Point {
24+
public static class Point3D extends Point {
2525
public int z;
2626

27-
protected Point3D() { }
27+
public Point3D() { }
2828
public Point3D(int x, int y, int z) {
2929
super(x, y);
3030
this.z = z;

protobuf/src/test/java/tools/jackson/dataformat/protobuf/WriteSimpleTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
public class WriteSimpleTest extends ProtobufTestBase
2323
{
24-
static class Point3D extends Point {
24+
public static class Point3D extends Point {
2525
public int z;
2626

2727
public Point3D(int x, int y, int z) {
@@ -39,11 +39,11 @@ public Point3D(int x, int y, int z) {
3939
;
4040

4141
@JsonPropertyOrder({ "id", "point" })
42-
static class IdPoints {
42+
public static class IdPoints {
4343
public int id;
4444
public List<Point> points;
4545

46-
protected IdPoints() { }
46+
public IdPoints() { }
4747

4848
public IdPoints(int id, int x, int y) {
4949
this.id = id;
@@ -64,7 +64,7 @@ public boolean equals(Object o) {
6464
}
6565
}
6666

67-
private final ObjectMapper MAPPER = new ObjectMapper(new ProtobufFactory());
67+
private final ObjectMapper MAPPER = newObjectMapper();
6868

6969
/*
7070
/**********************************************************

0 commit comments

Comments
 (0)