12
12
import com .fasterxml .jackson .databind .ObjectMapper ;
13
13
14
14
import com .fasterxml .jackson .datatype .jsr310 .JavaTimeModule ;
15
+ import de .sstoehr .harreader .jackson .DefaultMapperFactory ;
15
16
import org .junit .jupiter .api .Test ;
16
17
17
18
import de .sstoehr .harreader .model .Har ;
@@ -23,7 +24,7 @@ class HarWriterTests {
23
24
private static final File HAR_FILE = new File ("src/test/resources/sstoehr.har" );
24
25
25
26
@ Test
26
- void shouldWriteHarAsString () throws HarReaderException , IOException , HarWriterException {
27
+ void shouldWriteHarAsString () throws IOException {
27
28
Har expected = MAPPER .readValue (HAR_FILE , Har .class );
28
29
29
30
Har har = new HarReader ().readFromFile (HAR_FILE );
@@ -32,16 +33,16 @@ void shouldWriteHarAsString() throws HarReaderException, IOException, HarWriterE
32
33
}
33
34
34
35
@ Test
35
- void shouldWriteHarAsBytes () throws HarReaderException , IOException , HarWriterException {
36
+ void shouldWriteHarAsBytes () throws IOException {
36
37
Har expected = MAPPER .readValue (HAR_FILE , Har .class );
37
38
38
39
Har har = new HarReader ().readFromFile (HAR_FILE );
39
- HarWriter writer = new HarWriter ();
40
+ HarWriter writer = new HarWriter (new DefaultMapperFactory () );
40
41
assertEquals (MAPPER .writeValueAsString (expected ), new String (writer .writeAsBytes (har ), StandardCharsets .UTF_8 ));
41
42
}
42
43
43
44
@ Test
44
- void testWriteToOutputStream () throws IOException , HarWriterException {
45
+ void testWriteToOutputStream () throws IOException {
45
46
ByteArrayOutputStream baos = new ByteArrayOutputStream ();
46
47
Har expected = MAPPER .readValue (HAR_FILE , Har .class );
47
48
@@ -51,7 +52,7 @@ void testWriteToOutputStream() throws IOException, HarWriterException {
51
52
}
52
53
53
54
@ Test
54
- void testWriteToFile () throws IOException , HarWriterException {
55
+ void testWriteToFile () throws IOException {
55
56
File file = File .createTempFile ("pref" , "suff" );
56
57
Har expected = MAPPER .readValue (HAR_FILE , Har .class );
57
58
@@ -62,7 +63,7 @@ void testWriteToFile() throws IOException, HarWriterException {
62
63
}
63
64
64
65
@ Test
65
- void testWriteToWriter () throws IOException , HarWriterException {
66
+ void testWriteToWriter () throws IOException {
66
67
StringWriter sw = new StringWriter ();
67
68
Har expected = MAPPER .readValue (HAR_FILE , Har .class );
68
69
0 commit comments