01: package org.drools.brms.modeldriven;
02:
03: import junit.framework.TestCase;
04:
05: import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
06: import org.drools.brms.client.modeldriven.brl.ActionFieldValue;
07: import org.drools.brms.client.modeldriven.brl.ActionSetField;
08:
09: public class ActionSetFieldTest extends TestCase {
10:
11: public void testRemove() {
12: final ActionSetField set = new ActionSetField();
13: set.fieldValues = new ActionFieldValue[2];
14: final ActionFieldValue v0 = new ActionFieldValue("x", "42",
15: SuggestionCompletionEngine.TYPE_NUMERIC);
16: final ActionFieldValue v1 = new ActionFieldValue("y", "43",
17: SuggestionCompletionEngine.TYPE_NUMERIC);
18: set.fieldValues[0] = v0;
19: set.fieldValues[1] = v1;
20:
21: set.removeField(1);
22:
23: assertEquals(1, set.fieldValues.length);
24: assertEquals(v0, set.fieldValues[0]);
25:
26: }
27:
28: public void testAdd() {
29: final ActionSetField set = new ActionSetField();
30: set.fieldValues = new ActionFieldValue[2];
31: final ActionFieldValue v0 = new ActionFieldValue("x", "42",
32: SuggestionCompletionEngine.TYPE_NUMERIC);
33: final ActionFieldValue v1 = new ActionFieldValue("y", "43",
34: SuggestionCompletionEngine.TYPE_NUMERIC);
35: set.fieldValues[0] = v0;
36: set.fieldValues[1] = v1;
37:
38: final ActionFieldValue q = new ActionFieldValue("q", "q",
39: SuggestionCompletionEngine.TYPE_NUMERIC);
40: set.addFieldValue(q);
41:
42: assertEquals(3, set.fieldValues.length);
43: assertEquals(q, set.fieldValues[2]);
44: assertEquals(v0, set.fieldValues[0]);
45:
46: }
47:
48: }
|