1 16 package org.apache.cocoon.woody.datatype.convertor; 17 18 import java.util.Locale ; 19 20 import org.apache.cocoon.woody.datatype.Sex; 21 22 import junit.framework.TestCase; 23 24 29 public class EnumConvertorTestCase extends TestCase { 30 31 public EnumConvertorTestCase(String name) { 32 super(name); 33 } 34 35 39 public void testConvertFromString() { 40 EnumConvertor convertor = new EnumConvertor("org.apache.cocoon.woody.datatype.Sex"); 41 Object sex = convertor.convertFromString 42 (Sex.class.getName() + ".FEMALE", Locale.getDefault(), null); 43 assertSame("Returned sex must be FEMALE", Sex.FEMALE, sex); 44 } 45 46 50 public void testConvertToString() { 51 EnumConvertor convertor = new EnumConvertor("org.apache.cocoon.woody.datatype.Sex"); 52 assertEquals("Converted value must match string", 53 Sex.class.getName() + ".MALE", 54 convertor.convertToString 55 (Sex.MALE, Locale.getDefault(), null)); 56 } 57 } 58 | Popular Tags |