16
16
import static org .folio .marc4ld .test .helper .AuthorityValidationHelper .validateFocusResource ;
17
17
import static org .folio .marc4ld .test .helper .AuthorityValidationHelper .validateIdentifier ;
18
18
19
+ import java .util .HashMap ;
19
20
import java .util .List ;
20
21
import java .util .Map ;
21
22
import org .folio .marc4ld .Marc2LdTestBase ;
@@ -29,7 +30,7 @@ class MarcToLdAuthorityConceptPlace151IT extends Marc2LdTestBase {
29
30
private static final String EXPECTED_FOCUS_LABEL = "aValue" ;
30
31
31
32
@ Test
32
- void shouldMap151FieldCorrectly () {
33
+ void shouldMap151FieldToConceptPlaceResource_whenSubFocusFieldsArePresent () {
33
34
// given
34
35
var marc = loadResourceAsString ("authority/151/marc_151_concept_place.jsonl" );
35
36
@@ -41,25 +42,29 @@ void shouldMap151FieldCorrectly() {
41
42
.singleElement ()
42
43
.satisfies (resource -> assertThat (resource .getOutgoingEdges ()).hasSize (10 ))
43
44
.satisfies (
44
- resource -> validateResource (resource , List .of (CONCEPT , PLACE ), generalProperties (), EXPECTED_MAIN_LABEL ))
45
+ resource -> validateResource (resource , List .of (CONCEPT , PLACE ), conceptPlaceProperties (), EXPECTED_MAIN_LABEL ))
45
46
.satisfies (resource -> validateFocusResource (resource , PLACE , focusProperties (), EXPECTED_FOCUS_LABEL ))
46
47
.satisfies (AuthorityValidationHelper ::validateSubFocusResources )
47
48
.satisfies (resource -> validateIdentifier (resource , "010fieldvalue" ));
48
49
}
49
50
50
51
@ Test
51
- void shouldNotMap151FieldWhenSubFocusFieldsAreEmpty () {
52
+ void shouldMap151FieldToPlaceResource_whenSubFocusFieldsAreEmpty () {
52
53
// given
53
54
var marc = loadResourceAsString ("authority/151/marc_151_place_empty_subfocus.jsonl" );
54
55
55
56
// when
56
57
var resources = marcAuthorityToResources (marc );
57
58
58
59
//then
59
- assertThat (resources ).isEmpty ();
60
+ assertThat (resources )
61
+ .singleElement ()
62
+ .satisfies (resource -> assertThat (resource .getOutgoingEdges ()).hasSize (1 ))
63
+ .satisfies (resource -> validateResource (resource , List .of (PLACE ), placeProperties (), EXPECTED_FOCUS_LABEL ))
64
+ .satisfies (resource -> validateIdentifier (resource , "010fieldvalue" ));
60
65
}
61
66
62
- private Map <String , List <String >> generalProperties () {
67
+ private Map <String , List <String >> conceptPlaceProperties () {
63
68
return Map .of (
64
69
NAME .getValue (), List .of ("aValue" ),
65
70
MISC_INFO .getValue (), List .of ("gValue" ),
@@ -80,4 +85,10 @@ private Map<String, List<String>> focusProperties() {
80
85
);
81
86
}
82
87
88
+ private Map <String , List <String >> placeProperties () {
89
+ var placeProperties = new HashMap <>(focusProperties ());
90
+ placeProperties .put ("http://library.link/vocab/resourcePreferred" , List .of ("true" ));
91
+ return placeProperties ;
92
+ }
93
+
83
94
}
0 commit comments