1
1
package com .fasterxml .jackson .dataformat .protobuf ;
2
2
3
- import java .io .IOException ;
4
-
5
3
import org .junit .jupiter .api .Test ;
6
4
7
5
import com .fasterxml .jackson .databind .ObjectMapper ;
8
6
import com .fasterxml .jackson .dataformat .protobuf .schema .ProtobufSchema ;
9
7
import com .fasterxml .jackson .dataformat .protobuf .schema .ProtobufSchemaLoader ;
10
8
11
- /**
12
- * Created by miz on 8/10/16.
13
- */
14
- public class SerDeserLongTest {
9
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
10
+
11
+ public class SerDeserLongTest extends ProtobufTestBase
12
+ {
13
+ public static class BigNumPair {
14
+ public static final String protobuf_str =
15
+ "message BigNumPair {\n "
16
+ + " required int64 long1 = 1;\n "
17
+ + " required int64 long2 = 2;\n "
18
+ + "}\n " ;
19
+
20
+ public long long1 ;
21
+ public long long2 ;
22
+ }
23
+
15
24
@ Test
16
- public void testWeirdLongSerDeser () throws IOException {
17
- ObjectMapper mapper = new ObjectMapper ( new ProtobufFactory () );
25
+ public void testWeirdLongSerDeser () throws Exception {
26
+ ObjectMapper mapper = newObjectMapper ( );
18
27
ProtobufSchema schema = ProtobufSchemaLoader .std .parse (BigNumPair .protobuf_str );
19
28
20
29
BigNumPair bnp = new BigNumPair ();
@@ -25,7 +34,7 @@ public void testWeirdLongSerDeser() throws IOException {
25
34
26
35
BigNumPair parsed = mapper .readerFor (BigNumPair .class ).with (schema ).readValue (encoded );
27
36
28
- assert parsed .long1 == bnp .long1 ;
29
- assert parsed .long2 == bnp .long2 ;
37
+ assertEquals ( bnp .long1 , parsed .long1 ) ;
38
+ assertEquals ( bnp .long2 , parsed .long2 ) ;
30
39
}
31
40
}
0 commit comments