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