1 package org.mmbase.storage.search.implementation; 2 3 import junit.framework.*; 4 import org.mmbase.module.core.*; 5 import org.mmbase.module.corebuilders.FieldDefs; 6 import org.mmbase.storage.search.*; 7 8 14 public class BasicFieldConstraintTest extends TestCase { 15 16 private final static String BUILDER_NAME = "images"; 17 private final static String FIELD_NAME = "title"; 18 19 20 private BasicFieldConstraint instance = null; 21 22 23 private MMBase mmbase = null; 24 25 26 private StepField field = null; 27 28 29 private MMObjectBuilder builder = null; 30 31 32 private FieldDefs fieldDefs = null; 33 34 public BasicFieldConstraintTest(java.lang.String testName) { 35 super(testName); 36 } 37 38 public static void main(java.lang.String [] args) { 39 junit.textui.TestRunner.run(suite()); 40 } 41 42 45 public void setUp() throws Exception { 46 MMBaseContext.init(); 47 mmbase = MMBase.getMMBase(); 48 builder = mmbase.getBuilder(BUILDER_NAME); 49 fieldDefs = builder.getField(FIELD_NAME); 50 Step step = new BasicStep(builder); 51 field = new BasicStepField(step, fieldDefs); 52 instance = new BasicFieldConstraint(field) {}; } 54 55 58 public void tearDown() throws Exception {} 59 60 61 public void testGetField() { 62 assertTrue(instance.getField() != null); 63 assertTrue(instance.getField() == field); 64 } 65 66 67 public void testConstructor() { 68 try { 69 new BasicFieldConstraint(null); 71 fail("Null field, should throw IllegalArgumentException."); 72 } catch (IllegalArgumentException e) {} 73 } 74 75 76 public void testSetCaseSensitive() { 77 assertTrue(instance.isCaseSensitive()); 79 80 instance.setCaseSensitive(false); 81 assertTrue(!instance.isCaseSensitive()); 82 BasicFieldConstraint result = instance.setCaseSensitive(true); 83 assertTrue(instance.isCaseSensitive()); 84 assertTrue(result == instance); 85 } 86 87 88 public void testIsCaseSensitive() { 89 testSetCaseSensitive(); 91 } 92 93 94 public void testGetBasicSupportLevel() { 95 assertTrue(instance.getBasicSupportLevel() == SearchQueryHandler.SUPPORT_OPTIMAL); 97 } 98 99 100 public void testEquals() { 101 } 103 104 105 public void testHashCode() { 106 } 108 109 public static Test suite() { 110 TestSuite suite = new TestSuite(BasicFieldConstraintTest.class); 111 112 return suite; 113 } 114 115 } 116 | Popular Tags |