1 | package pl.zankowski.iextrading4j.client.mapper; | |
2 | ||
3 | import com.fasterxml.jackson.core.JsonParser; | |
4 | import com.fasterxml.jackson.databind.DeserializationContext; | |
5 | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; | |
6 | ||
7 | import java.io.IOException; | |
8 | import java.time.LocalDateTime; | |
9 | import java.time.format.DateTimeFormatter; | |
10 | ||
11 | public class HackyLocalDateTimeDeserializer extends LocalDateTimeDeserializer { | |
12 | ||
13 | private static final long serialVersionUID = 6548084168469622703L; | |
14 | ||
15 | private static final DateTimeFormatter DEFAULT_FORMATTER = DateTimeFormatter.ISO_LOCAL_DATE_TIME; | |
16 | ||
17 | HackyLocalDateTimeDeserializer() { | |
18 | super(DEFAULT_FORMATTER); | |
19 | } | |
20 | ||
21 | HackyLocalDateTimeDeserializer(DateTimeFormatter dtf) { | |
22 | super(dtf); | |
23 | } | |
24 | ||
25 | @Override | |
26 | protected LocalDateTimeDeserializer withDateFormat(DateTimeFormatter dtf) { | |
27 |
1
1. withDateFormat : replaced return value with null for pl/zankowski/iextrading4j/client/mapper/HackyLocalDateTimeDeserializer::withDateFormat → NO_COVERAGE |
return new HackyLocalDateTimeDeserializer(dtf); |
28 | } | |
29 | ||
30 | @Override | |
31 | public LocalDateTime deserialize(final JsonParser parser, final DeserializationContext context) throws IOException { | |
32 | final String val = parser.getValueAsString(); | |
33 | ||
34 | // #HACK In Daily List they return "0" if data is not available | |
35 |
2
1. deserialize : negated conditional → KILLED 2. deserialize : negated conditional → KILLED |
if (val == null || val.equals("0")) { |
36 | return null; | |
37 | } | |
38 | ||
39 |
1
1. deserialize : replaced return value with null for pl/zankowski/iextrading4j/client/mapper/HackyLocalDateTimeDeserializer::deserialize → KILLED |
return super.deserialize(parser, context); |
40 | } | |
41 | } | |
Mutations | ||
27 |
1.1 |
|
35 |
1.1 2.2 |
|
39 |
1.1 |