Skip to content

Commit 5551c32

Browse files
committed
Merge branch '2.19' into 2.20
2 parents 4f21d2d + 4eaa38f commit 5551c32

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
11
package com.fasterxml.jackson.dataformat.cbor.parse;
22

3+
import org.junit.jupiter.api.Test;
34

4-
import java.io.IOException;
55
import java.nio.charset.StandardCharsets;
66

77
import com.fasterxml.jackson.core.JsonToken;
8+
import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
89
import com.fasterxml.jackson.dataformat.cbor.CBORParser;
910
import com.fasterxml.jackson.dataformat.cbor.CBORTestBase;
10-
import org.junit.jupiter.api.Test;
1111

1212
import static org.junit.jupiter.api.Assertions.assertEquals;
1313

14-
public class ParseLongAsciiTextTest extends CBORTestBase {
15-
14+
public class ParseLongAsciiTextTest extends CBORTestBase
15+
{
16+
private final CBORFactory CBOR_F = cborFactory();
1617

1718
@Test
18-
public void testLongNonChunkedAsciiText() throws IOException {
19-
CBORParser p = cborFactory().createParser(this.getClass().getResourceAsStream("/data/macbeth-snippet-non-chunked.cbor"));
20-
21-
assertEquals(JsonToken.VALUE_STRING, p.nextToken());
22-
String expected = new String(readResource("/data/macbeth-snippet.txt"), "UTF-8");
23-
assertEquals(expected, p.getText());
24-
19+
public void testLongNonChunkedAsciiText() throws Exception {
20+
try (CBORParser p = CBOR_F.createParser(this.getClass().getResourceAsStream("/data/macbeth-snippet-non-chunked.cbor"))) {
21+
assertEquals(JsonToken.VALUE_STRING, p.nextToken());
22+
String expected = new String(readResource("/data/macbeth-snippet.txt"), "UTF-8");
23+
assertEquals(expected, p.getText());
24+
}
2525
}
2626

2727
@Test
28-
public void testLongChunkedAsciiText() throws IOException {
29-
CBORParser p = cborFactory().createParser(this.getClass().getResourceAsStream("/data/macbeth-snippet-chunked.cbor"));
30-
31-
assertEquals(JsonToken.VALUE_STRING, p.nextToken());
32-
String expected = new String(readResource("/data/macbeth-snippet.txt"), StandardCharsets.UTF_8);
33-
assertEquals(expected, p.getText());
28+
public void testLongChunkedAsciiText() throws Exception {
29+
try (CBORParser p = CBOR_F.createParser(this.getClass().getResourceAsStream("/data/macbeth-snippet-chunked.cbor"))) {
30+
assertEquals(JsonToken.VALUE_STRING, p.nextToken());
31+
String expected = new String(readResource("/data/macbeth-snippet.txt"), StandardCharsets.UTF_8);
32+
assertEquals(expected, p.getText());
33+
}
3434
}
35-
3635
}

0 commit comments

Comments
 (0)