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