1 package utility;
2
3 import junit.framework.Assert;
4 import org.junit.Test;
5 import org.kuali.ole.docstore.OleException;
6 import org.kuali.ole.docstore.utility.ISBNUtil;
7 import org.kuali.ole.docstore.xstream.BaseTestCase;
8 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory;
10
11 import java.util.ArrayList;
12 import java.util.List;
13
14
15
16
17
18
19
20
21 public class ISBNUtility_UT
22 extends BaseTestCase {
23
24 private static final Logger LOG = LoggerFactory.getLogger(ISBNUtility_UT.class);
25
26 @Test
27 public void testNormalization() throws OleException {
28 ISBNUtil isbnUtil = new ISBNUtil();
29 List<String> isbnList = new ArrayList<String>();
30 isbnList.add("0304935085");
31 isbnList.add("0304935085847");
32 isbnList.add("0714839337 (v. 3)");
33 isbnList.add("0879514663 (set)");
34 isbnList.add("087951468X (v. 2) :");
35 isbnList.add("087951468X");
36 isbnList.add("8086098044 :");
37 isbnList.add("9781433113178 (hbk. : alk. paper)");
38 isbnList.add("1433113171 (hbk. : alk. paper)");
39 isbnList.add("978143311317X");
40 for (String isbn : isbnList) {
41 String normalizedIsbn = isbnUtil.normalizeISBN(isbn);
42 LOG.info(normalizedIsbn);
43 System.out.println(normalizedIsbn);
44 Assert.assertEquals(13, normalizedIsbn.length());
45 }
46
47 }
48 }