1 33 34 package edu.rice.cs.drjava.config; 35 36 import edu.rice.cs.drjava.DrJavaTestCase; 37 38 43 public final class BooleanOptionTest extends DrJavaTestCase 44 { 45 48 public BooleanOptionTest(String name) { super(name); } 49 50 public void testGetName() 51 { 52 BooleanOption bo1 = new BooleanOption("enable JUnit",null); 53 BooleanOption bo2 = new BooleanOption("use menu icons",null); 54 55 assertEquals("enable JUnit", bo1.getName()); 56 assertEquals("use menu icons", bo2.getName()); 57 } 58 59 public void testParse() 60 { 61 BooleanOption bo = new BooleanOption("enable JUnit",null); 62 63 assertEquals(Boolean.TRUE, bo.parse("true")); 64 assertEquals(Boolean.FALSE, bo.parse("false")); 65 assertEquals(Boolean.FALSE, bo.parse(" faLse ")); 66 67 try { bo.parse("3"); fail(); } 68 catch (OptionParseException e) { } 69 70 try { bo.parse("Tue"); fail(); } 71 catch (OptionParseException e) { } 72 } 73 74 public void testFormat() 75 { 76 BooleanOption bo1 = new BooleanOption("max_files",null); 77 BooleanOption bo2 = new BooleanOption("indent_size",null); 78 79 assertEquals("true", bo1.format(Boolean.TRUE)); 80 assertEquals("true", bo2.format(Boolean.TRUE)); 81 assertEquals("false", bo1.format(Boolean.FALSE)); 82 assertEquals("false", bo2.format(Boolean.FALSE)); 83 } 84 } 85 | Popular Tags |