1 package org.kuali.ole.utility.callnumber;
2
3
4 import org.junit.Assert;
5 import org.junit.Test;
6 import org.kuali.ole.docstore.xstream.BaseTestCase;
7
8
9
10
11
12
13
14
15 public class NLMCallNumber_UT extends BaseTestCase {
16
17 @Test
18 public void testNormalize() {
19 try {
20 String callNumberType = "NLM";
21
22 String[] callNumberArrayForNLM = {"QS 11 c815a 1930", "QS 11 c815a 1930a", "QS 11 c815at 1927", "QS 532.5.A3 N532 1985", "QS 532.5.A3 SL no.1 1986", "WB110 C454t 2002", "WO100 S 9623 2000"};
23 String[] normalizedCallNumberForNLM = {"QS 0011.000000 C0.815000 A 001930", "QS 0011.000000 C0.815000 A 001930A", "QS 0011.000000 C0.815000 AT 001927", "QS 0532.500000 A0.300000 N0.532000 001985", "QS 0532.500000 A0.300000 SL NO.000001 001986", "WB 0110.000000 C0.454000 T 002002", "WO 0100.000000 S 009623 002000"};
24
25 for (int i = 0; i < callNumberArrayForNLM.length; i++) {
26 CallNumber callNumber = CallNumberFactory.getInstance().getCallNumber(callNumberType);
27 String normalisedCallNumber = callNumber.getSortableKey(callNumberArrayForNLM[i]);
28 Assert.assertEquals(normalizedCallNumberForNLM[i], normalisedCallNumber);
29 System.out.println(callNumberArrayForNLM[i] + ":::normalized call number:::" + normalisedCallNumber);
30 }
31 } catch (Exception e) {
32 e.printStackTrace();
33 }
34 }
35
36 @Test
37 public void testValidCallNumber() throws Exception {
38 String callNumberType = "NLM";
39 String number = "DK602 .P44 1901";
40 CallNumber callNumber = CallNumberFactory.getInstance().getCallNumber(callNumberType);
41 boolean valid = callNumber.isValid(number);
42 System.out.println("valid:" + valid);
43 }
44 }