1
2
3
4
5
6
7
8 package org.codehaus.metaclass.tools.tasks;
9
10 import junit.framework.TestCase;
11 import org.apache.tools.ant.BuildException;
12
13 /***
14 * @author Peter Donald
15 * @version $Revision: 1.3 $ $Date: 2003/11/28 11:14:55 $
16 */
17 public class FormatEnumTestCase
18 extends TestCase
19 {
20 public void testBinaryFormat()
21 throws Exception
22 {
23 final FormatEnum enum = new FormatEnum();
24 enum.setValue( "binary" );
25 assertEquals( GenerateClassDescriptorsTask.BINARY_TYPE,
26 enum.getTypeCode() );
27 }
28
29 public void testXMLFormat()
30 throws Exception
31 {
32 final FormatEnum enum = new FormatEnum();
33 enum.setValue( "xml" );
34 assertEquals( GenerateClassDescriptorsTask.XML_TYPE,
35 enum.getTypeCode() );
36 }
37
38 public void testUnknownFormat()
39 throws Exception
40 {
41 final FormatEnum enum = new FormatEnum();
42 try
43 {
44 enum.setValue( "unknown" );
45 }
46 catch( BuildException e )
47 {
48 return;
49 }
50 fail( "Expected to fail to set unknown type" );
51 }
52 }