-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
106 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
|
||
### Added | ||
|
||
- British Library tags: 039, 091, 509, 539, 590 | ||
- British Library tags: 039, 091, 509, 539, 590, | ||
591 |
44 changes: 44 additions & 0 deletions
44
src/main/java/de/gwdg/metadataqa/marc/definition/tags/bltags/Tag591.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package de.gwdg.metadataqa.marc.definition.tags.bltags; | ||
|
||
import de.gwdg.metadataqa.marc.definition.Cardinality; | ||
import de.gwdg.metadataqa.marc.definition.DataFieldDefinition; | ||
import de.gwdg.metadataqa.marc.definition.Indicator; | ||
|
||
/** | ||
* National Bibliography Issue Number | ||
*/ | ||
public class Tag591 extends DataFieldDefinition { | ||
|
||
private static Tag591 uniqueInstance; | ||
|
||
private Tag591() { | ||
initialize(); | ||
postCreation(); | ||
} | ||
|
||
public static Tag591 getInstance() { | ||
if (uniqueInstance == null) | ||
uniqueInstance = new Tag591(); | ||
return uniqueInstance; | ||
} | ||
|
||
private void initialize() { | ||
|
||
tag = "591"; | ||
label = "Document Supply Conference Note"; | ||
mqTag = "documentSupplyConferenceNote"; | ||
cardinality = Cardinality.Repeatable; | ||
// descriptionUrl = "https://www.loc.gov/marc/bibliographic/bd037.html"; | ||
// setCompilanceLevels("O"); | ||
|
||
ind1 = new Indicator(); | ||
ind2 = new Indicator(); | ||
|
||
setSubfieldsWithCardinality( | ||
"a", "Conference note", "NR" | ||
); | ||
|
||
getSubfield("a") | ||
.setMqTag("conferenceNote"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/test/java/de/gwdg/metadataqa/marc/definition/tags/bltags/Tag591Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package de.gwdg.metadataqa.marc.definition.tags.bltags; | ||
|
||
import de.gwdg.metadataqa.marc.DataField; | ||
import de.gwdg.metadataqa.marc.MarcRecord; | ||
import de.gwdg.metadataqa.marc.definition.MarcVersion; | ||
import org.junit.Test; | ||
|
||
import static junit.framework.TestCase.assertFalse; | ||
import static junit.framework.TestCase.assertTrue; | ||
|
||
public class Tag591Test { | ||
|
||
@Test | ||
public void testValidFields() { | ||
validField("a", "Papers. Based on those presented at the conference."); | ||
} | ||
|
||
@Test | ||
public void testInvalidFields() { | ||
invalidField("b", "NLS copy dimensions: 16 cm."); | ||
invalidField("1", "a", "NLS copy dimensions: 16 cm."); | ||
} | ||
|
||
public void validField(String subfield, String value) { | ||
DataField field = new DataField(Tag591.getInstance(), " ", " ", subfield, value); | ||
|
||
MarcRecord record = new MarcRecord("test"); | ||
field.setRecord(record); | ||
|
||
assertFalse( | ||
String.format("591$%s=%s should be invalid in normal case", subfield, value), | ||
field.validate(MarcVersion.MARC21)); | ||
assertTrue( | ||
String.format("591$%s=%s should be valid in normal case", subfield, value), | ||
field.validate(MarcVersion.BL)); | ||
} | ||
|
||
public void invalidField(String subfield, String value) { | ||
invalidField(" ", subfield, value); | ||
} | ||
|
||
public void invalidField(String ind1, String subfield, String value) { | ||
DataField field = new DataField(Tag591.getInstance(), ind1, " ", subfield, value); | ||
|
||
MarcRecord record = new MarcRecord("test"); | ||
field.setRecord(record); | ||
|
||
assertFalse( | ||
String.format("591$%s=%s should be invalid in normal case", subfield, value), | ||
field.validate(MarcVersion.MARC21)); | ||
assertFalse( | ||
String.format("591$%s=%s should be invalid in BL", subfield, value), | ||
field.validate(MarcVersion.BL)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters