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 BasicSortOrderTest extends TestCase { 15 16 17 private BasicSortOrder instance = null; 18 19 20 private BasicStepField field = null; 21 22 23 private MMBase mmbase = null; 24 25 public BasicSortOrderTest(java.lang.String testName) { 26 super(testName); 27 } 28 29 public static void main(java.lang.String [] args) { 30 junit.textui.TestRunner.run(suite()); 31 } 32 33 36 public void setUp() throws Exception { 37 MMBaseContext.init(); 38 mmbase = MMBase.getMMBase(); 39 MMObjectBuilder builder = mmbase.getBuilder("images"); 40 FieldDefs fieldDefs = builder.getField("title"); 41 Step step = new BasicStep(builder); 42 field = new BasicStepField(step, fieldDefs); 43 instance = new BasicSortOrder(field); 44 } 45 46 49 public void tearDown() throws Exception {} 50 51 52 public void testSetDirection() { 53 assertTrue(instance.getDirection() == SortOrder.ORDER_ASCENDING); 55 56 try { 58 instance.setDirection(-1); 59 fail("Invalid value, should throw IllegalArgumentException."); 60 } catch (IllegalArgumentException e) {} 61 62 BasicSortOrder result 63 = instance.setDirection(SortOrder.ORDER_DESCENDING); 64 assertTrue(instance.getDirection() == SortOrder.ORDER_DESCENDING); 65 assertTrue(result == instance); 66 } 67 68 69 public void testGetField() { 70 assertTrue(instance.getField() == field); 71 } 72 73 74 public void testGetDirection() { 75 testSetDirection(); 77 } 78 79 80 public void testEquals() { 81 } 83 84 85 public void testHashCode() { 86 } 88 89 90 public static Test suite() { 91 TestSuite suite = new TestSuite(BasicSortOrderTest.class); 92 93 return suite; 94 } 95 96 } 97 | Popular Tags |