1 33 34 package edu.rice.cs.drjava.config; 35 36 import edu.rice.cs.drjava.DrJavaTestCase; 37 38 41 public final class IntegerOptionTest extends DrJavaTestCase { 42 43 44 public IntegerOptionTest(String name) { super(name); } 45 46 public void testGetName() { 47 IntegerOption io1 = new IntegerOption("indent_size",null); 48 IntegerOption io2 = new IntegerOption("max_files",null); 49 50 assertEquals("indent_size", io1.getName()); 51 assertEquals("max_files", io2.getName()); 52 } 53 54 public void testParse() { 55 IntegerOption io = new IntegerOption("max_files",null); 56 57 assertEquals(new Integer (3), io.parse("3")); 58 assertEquals(new Integer (-3), io.parse("-3")); 59 60 try { io.parse("true"); fail(); } 61 catch (OptionParseException e) { } 62 63 try { io.parse(".33"); fail(); } 64 catch (OptionParseException e) { } 65 } 66 67 public void testFormat() { 68 IntegerOption io1 = new IntegerOption("max_files",null); 69 IntegerOption io2 = new IntegerOption("indent_size",null); 70 71 assertEquals("33", io1.format(new Integer (33))); 72 assertEquals("33", io2.format(new Integer (33))); 73 assertEquals("-11", io1.format(new Integer (-11))); 74 assertEquals("-11", io2.format(new Integer (-11))); 75 } 76 } 77 | Popular Tags |