1 16 package net.sf.dozer.util.mapping; 17 18 import java.util.ArrayList ; 19 import java.util.List ; 20 import java.util.Random ; 21 22 import net.sf.dozer.util.mapping.util.MapperConstants; 23 24 import junit.framework.TestCase; 25 26 29 public abstract class DozerTestBase extends TestCase { 30 private static Random rand = new Random (System.currentTimeMillis()); 31 protected MapperIF mapper = null; 32 33 protected void setUp() throws Exception { 34 System.setProperty("log4j.debug","true"); 35 System.setProperty(MapperConstants.DEBUG_SYS_PROP,"true"); 36 mapper = new DozerBeanMapper(); 37 } 38 39 protected MapperIF getNewMapper(String [] mappingFiles) { 40 List list = new ArrayList (); 41 if (mappingFiles != null) { 42 for (int i = 0; i < mappingFiles.length; i++) { 43 list.add(mappingFiles[i]); 44 } 45 } 46 MapperIF mapper = new DozerBeanMapper(); 47 ((DozerBeanMapper) mapper).setMappingFiles(list); 48 return mapper; 49 } 50 51 protected String getRandomString() { 52 return String.valueOf(rand.nextInt()); 53 } 54 55 56 } | Popular Tags |