001 package utility; 002 003 import junit.framework.Assert; 004 import org.junit.Test; 005 import org.kuali.ole.docstore.OleException; 006 import org.kuali.ole.docstore.utility.ISBNUtil; 007 import org.kuali.ole.docstore.xstream.BaseTestCase; 008 import org.slf4j.Logger; 009 import org.slf4j.LoggerFactory; 010 011 import java.util.ArrayList; 012 import java.util.List; 013 014 /** 015 * Created by IntelliJ IDEA. 016 * User: Pranitha 017 * Date: 4/6/12 018 * Time: 12:20 PM 019 * To change this template use File | Settings | File Templates. 020 */ 021 public class ISBNUtility_UT 022 extends BaseTestCase { 023 024 private static final Logger LOG = LoggerFactory.getLogger(ISBNUtility_UT.class); 025 026 @Test 027 public void testNormalization() throws OleException { 028 ISBNUtil isbnUtil = new ISBNUtil(); 029 List<String> isbnList = new ArrayList<String>(); 030 isbnList.add("0304935085"); 031 isbnList.add("0304935085847"); 032 isbnList.add("0714839337 (v. 3)"); 033 isbnList.add("0879514663 (set)"); 034 isbnList.add("087951468X (v. 2) :"); 035 isbnList.add("087951468X"); 036 isbnList.add("8086098044 :"); 037 isbnList.add("9781433113178 (hbk. : alk. paper)"); 038 isbnList.add("1433113171 (hbk. : alk. paper)"); 039 isbnList.add("978143311317X"); 040 for (String isbn : isbnList) { 041 String normalizedIsbn = isbnUtil.normalizeISBN(isbn); 042 LOG.info(normalizedIsbn); 043 System.out.println(normalizedIsbn); 044 Assert.assertEquals(13, normalizedIsbn.length()); 045 } 046 047 } 048 }