use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.
the class MarcRecordImplTest method getCitationFormatError.
@Test
public void getCitationFormatError() throws Exception {
MarcRecordImpl mri;
MetadataRecord metadataRecord;
List<String> data = new ArrayList<>();
data.add("000 00000000");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getCitationFormat(), CitationRecordType.ERROR);
data.clear();
}
use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.
the class MarcRecordImplTest method getISSNsTest.
@Test
public void getISSNsTest() throws Exception {
MarcRecordImpl mri;
MetadataRecord metadataRecord;
List<String> data = new ArrayList<>();
List<Issn> issns = new ArrayList<>();
Long issnCounter = 0L;
// no issn test
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getISSNs(), Collections.EMPTY_LIST);
data.clear();
// create issn
data.add("022 $a2336-4815");
issns.add(Issn.create("2336-4815", ++issnCounter, ""));
data.add("022 $a1214-4029 (pozn)");
issns.add(Issn.create("1214-4029", ++issnCounter, "pozn"));
data.add("022 $a0231-858X");
issns.add(Issn.create("0231-858X", ++issnCounter, ""));
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getISSNs().toString(), issns.toString());
}
use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.
the class MarcRecordImplTest method getWeightTest.
@Test
public void getWeightTest() throws Exception {
MarcRecordImpl mri;
MetadataRecord metadataRecord;
List<String> data = new ArrayList<>();
data.add("000 01234567890123456a");
data.add("008 asd");
data.add("020 $a80-200-0980-9");
data.add("040 $erda");
data.add("080 456");
data.add("100 $aasd");
data.add("245 00$asasd");
data.add("300 $asd");
data.add("752 $7asd");
data.add("964 $asd");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getWeight(0L).longValue(), 5L);
data.clear();
}
use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.
the class MarcRecordImplTest method getPageCountTest.
@Test
public void getPageCountTest() throws Exception {
MarcRecordImpl mri;
MetadataRecord metadataRecord;
List<String> data = new ArrayList<>();
data.add("300 $a257 s.");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPageCount().longValue(), 257);
data.clear();
data.add("300 $a1 zvuková deska (78:24)");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPageCount().longValue(), 78);
data.clear();
data.add("300 $a[14] s.");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPageCount().longValue(), 14);
data.clear();
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getPageCount(), null);
data.clear();
}
use of cz.mzk.recordmanager.server.metadata.MetadataRecord in project RecordManager2 by moravianlibrary.
the class MarcRecordImplTest method getEANsTest.
@Test
public void getEANsTest() throws Exception {
MarcRecordImpl mri;
MetadataRecord metadataRecord;
List<String> data = new ArrayList<>();
List<Ean> eanList = new ArrayList<>();
// no ean
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
Assert.assertEquals(metadataRecord.getEANs(), Collections.EMPTY_LIST);
// create eans
data.add("024 3 $a4006381333931$q(brož.)");
eanList.add(Ean.create(4006381333931L, 1L, "brož."));
data.add("024 3 $a4006381333931 note$q(sešity v obálce)");
eanList.add(Ean.create(4006381333931L, 2L, "note sešity v obálce"));
data.add("024 3 $a4006381333931$q(Praha ;$qv hudebnině neuvedeno ;$qbrož.)");
eanList.add(Ean.create(4006381333931L, 3L, "Praha v hudebnině neuvedeno ; brož."));
// invalid
data.add("024 3 $a73513536 (Brno)$q(Praha)");
mri = MarcRecordFactory.recordFactory(data);
metadataRecord = metadataFactory.getMetadataRecord(mri);
List<Ean> results = metadataRecord.getEANs();
Assert.assertEquals(results.size(), eanList.size());
for (int i = 0; i < eanList.size(); i++) {
Assert.assertEquals(results.get(i), eanList.get(i), String.format("EAN on position %d differs.", i));
}
}
Aggregations