Skip to content

Commit 70bce80

Browse files
committed
Minor fixes, yet to fix protobuf one
1 parent 1324f2a commit 70bce80

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

avro/src/test/java/tools/jackson/dataformat/avro/RootEmptyRecord177Test.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44

55
import com.fasterxml.jackson.annotation.JsonAutoDetect;
66

7+
import tools.jackson.databind.DeserializationFeature;
8+
79
import static org.junit.jupiter.api.Assertions.assertEquals;
810

911
public class RootEmptyRecord177Test extends AvroTestBase
1012
{
11-
private final AvroMapper MAPPER = getMapper();
12-
13-
private final AvroSchema SCHEMA = parseSchema(MAPPER,
14-
"{'type':'record', 'name':'Empty','namespace':'something','fields':[]}");
15-
1613
@JsonAutoDetect // just a marker to avoid "no properties found" exception
1714
public static final class Empty {
1815
@Override
@@ -22,11 +19,21 @@ public boolean equals(Object o) {
2219
}
2320

2421
@Test
25-
public void testEmptyRecord() throws Exception {
22+
public void testEmptyRecord() throws Exception
23+
{
24+
// 30-Jan-2025, tatu: For some reason, we get "endless stream" of
25+
// empty Objects for 0 byte size records. For now, work aroudn
26+
final AvroMapper mapper = mapperBuilder()
27+
.disable(DeserializationFeature.FAIL_ON_TRAILING_TOKENS)
28+
.build();
29+
30+
final AvroSchema SCHEMA = parseSchema(mapper,
31+
"{'type':'record', 'name':'Empty','namespace':'something','fields':[]}");
32+
2633
final Empty empty = new Empty();
2734

28-
byte[] ser = MAPPER.writer().with(SCHEMA).writeValueAsBytes(empty);
29-
final Empty result = MAPPER.readerFor(Empty.class)
35+
byte[] ser = mapper.writer().with(SCHEMA).writeValueAsBytes(empty);
36+
final Empty result = mapper.readerFor(Empty.class)
3037
.with(SCHEMA)
3138
.readValue(ser);
3239

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ public abstract class ProtobufTestBase
1919
/**********************************************************
2020
*/
2121

22-
enum Corpus {
22+
public enum Corpus {
2323
UNIVERSAL,
2424
WEB;
2525
}
2626

27-
static class SearchRequest {
27+
public static class SearchRequest {
2828
public String query;
2929
public int page_number, result_per_page;
3030
public Corpus corpus;
@@ -151,11 +151,11 @@ static class SearchRequest {
151151
*/
152152

153153
@JsonPropertyOrder({ "x", "y"})
154-
static class Point {
154+
public static class Point {
155155
public int x;
156156
public int y;
157157

158-
protected Point() { }
158+
public Point() { }
159159

160160
public Point(int x, int y) {
161161
this.x = x;
@@ -177,7 +177,7 @@ public boolean equals(Object o) {
177177
}
178178

179179
@JsonPropertyOrder({ "x", "y", "z" })
180-
static class Point3 {
180+
public static class Point3 {
181181
public int x, y, z;
182182

183183
protected Point3() { }
@@ -202,7 +202,7 @@ public boolean equals(Object o) {
202202
}
203203
}
204204

205-
static class PointL {
205+
public static class PointL {
206206
public long x;
207207
public long y;
208208

@@ -227,7 +227,7 @@ public boolean equals(Object o) {
227227
}
228228
}
229229

230-
static class OptionalValue {
230+
public static class OptionalValue {
231231
public boolean present;
232232
public String value;
233233

@@ -255,7 +255,7 @@ public boolean equals(Object o) {
255255
}
256256
}
257257

258-
static class PointD {
258+
public static class PointD {
259259
public double x;
260260
public double y;
261261

@@ -281,7 +281,7 @@ public boolean equals(Object o) {
281281
}
282282

283283
@JsonPropertyOrder({ "topLeft", "bottomRight"})
284-
static class Box {
284+
public static class Box {
285285
public Point topLeft, bottomRight;
286286

287287
public Box() { }
@@ -301,7 +301,7 @@ public String toString() {
301301
}
302302

303303
@JsonPropertyOrder({ "first", "last"})
304-
static class Name {
304+
public static class Name {
305305
public String first, last;
306306

307307
public Name() { }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ public class ReadSimpleProtobufTest extends ProtobufTestBase
3939
+"}\n"
4040
;
4141

42-
static class Strings {
42+
public static class Strings {
4343
public String[] values;
4444

4545
public Strings() { }
4646
public Strings(String... v) { values = v; }
4747
}
4848

49-
static class NamedStrings {
49+
public static class NamedStrings {
5050
public String name;
5151
public String[] values;
5252

0 commit comments

Comments
 (0)