1 | package com.yubico.fido.metadata; | |
2 | ||
3 | import com.fasterxml.jackson.annotation.JsonCreator; | |
4 | import com.fasterxml.jackson.annotation.JsonValue; | |
5 | import java.util.Map; | |
6 | import java.util.Optional; | |
7 | import lombok.AccessLevel; | |
8 | import lombok.AllArgsConstructor; | |
9 | import lombok.Getter; | |
10 | import lombok.Value; | |
11 | ||
12 | /** | |
13 | * See: | |
14 | * https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.0-ps-20210518.html#alternativedescriptions-dictionary | |
15 | * | |
16 | * @see <a | |
17 | * href="https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.0-ps-20210518.html#alternativedescriptions-dictionary">FIDO | |
18 | * Metadata Statement §3.11. AlternativeDescriptions dictionary</a> | |
19 | */ | |
20 | @Value | |
21 | @AllArgsConstructor(onConstructor_ = {@JsonCreator}) | |
22 | public class AlternativeDescriptions { | |
23 | ||
24 | @JsonValue | |
25 | @Getter(AccessLevel.NONE) | |
26 | Map<String, String> values; | |
27 | ||
28 | /** | |
29 | * Get a map entry in accordance with the rules defined in <a | |
30 | * href="https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.0-ps-20210518.html#alternativedescriptions-dictionary">AlternativeDescriptions | |
31 | * dictionary</a>. | |
32 | * | |
33 | * @see <a | |
34 | * href="https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.0-ps-20210518.html#alternativedescriptions-dictionary">AlternativeDescriptions | |
35 | * dictionary</a>. | |
36 | */ | |
37 | public Optional<String> get(String languageCode) { | |
38 |
1
1. get : negated conditional → NO_COVERAGE |
if (values.containsKey(languageCode)) { |
39 |
1
1. get : replaced return value with Optional.empty for com/yubico/fido/metadata/AlternativeDescriptions::get → NO_COVERAGE |
return Optional.of(values.get(languageCode)); |
40 | } else { | |
41 | final String[] splits = languageCode.split("-"); | |
42 |
3
1. get : changed conditional boundary → NO_COVERAGE 2. get : negated conditional → NO_COVERAGE 3. get : negated conditional → NO_COVERAGE |
if (splits.length > 1 && values.containsKey(splits[0])) { |
43 |
1
1. get : replaced return value with Optional.empty for com/yubico/fido/metadata/AlternativeDescriptions::get → NO_COVERAGE |
return Optional.of(values.get(splits[0])); |
44 | } else { | |
45 | return Optional.empty(); | |
46 | } | |
47 | } | |
48 | } | |
49 | } | |
Mutations | ||
38 |
1.1 |
|
39 |
1.1 |
|
42 |
1.1 2.2 3.3 |
|
43 |
1.1 |