| 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 BasicAggregatedFieldTest extends TestCase { 15 16 private final static String IMAGES = "images"; 17 private final static String TITLE = "title"; 18 19 20 private BasicAggregatedField instance; 21 22 23 private BasicStep step; 24 25 26 private MMBase mmbase = null; 27 28 29 private MMObjectBuilder images = null; 30 31 32 private FieldDefs fieldDefs = null; 33 34 public BasicAggregatedFieldTest(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 System.exit(0); 41 } 42 43 46 public void setUp() throws Exception { 47 MMBaseContext.init(); 48 mmbase = MMBase.getMMBase(); 49 images = mmbase.getBuilder(IMAGES); 50 fieldDefs = images.getField(TITLE); 51 step = new BasicStep(images); 52 instance = new BasicAggregatedField(step, fieldDefs, 53 AggregatedField.AGGREGATION_TYPE_MAX); 54 } 55 56 59 public void tearDown() throws Exception {} 60 61 62 public void testSetAggregationType() { 63 assertTrue(instance.getAggregationType() 64 == AggregatedField.AGGREGATION_TYPE_MAX); 65 BasicAggregatedField result = 66 instance.setAggregationType( 67 AggregatedField.AGGREGATION_TYPE_GROUP_BY); 68 assertTrue(instance.getAggregationType() 69 == AggregatedField.AGGREGATION_TYPE_GROUP_BY); 70 assertTrue(result == instance); 71 72 try { 73 instance.setAggregationType(0); 75 fail("Invalid aggregation type, should throw IllegalArgumentException."); 76 instance.setAggregationType(6); 77 fail("Invalid aggregation type, should throw IllegalArgumentException."); 78 } catch (IllegalArgumentException e) {} 79 } 80 81 82 public void testGetAggregationType() { 83 testSetAggregationType(); 85 } 86 87 88 public void testEquals() { 89 } 91 92 93 public void testHashCode() { 94 } 96 97 public static Test suite() { 98 TestSuite suite = new TestSuite(BasicAggregatedFieldTest.class); 99 100 return suite; 101 } 102 103 } 104 | Popular Tags |