1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.rule;
17
18 import org.junit.Test;
19 import org.kuali.rice.kns.document.Document;
20 import org.kuali.rice.kns.document.MaintenanceDocument;
21 import org.kuali.rice.kns.rule.event.PromptBeforeValidationEvent;
22 import org.kuali.rice.kns.rules.PromptBeforeValidationBase;
23 import org.kuali.rice.kns.rules.PromptBeforeValidationBase.ContextSession;
24 import org.kuali.test.KNSTestCase;
25 import org.kuali.test.KNSWithTestSpringContext;
26
27 @KNSWithTestSpringContext
28 public class PromptBeforeValidationContinuationBaseTest extends KNSTestCase {
29
30 private class TestPreRules extends PromptBeforeValidationBase {
31 @Override
32 public boolean doPrompts(Document document) {
33 MaintenanceDocument maintenanceDocument = (MaintenanceDocument) document;
34 return false;
35 }
36
37 }
38
39 @Test public void test() {
40
41 TestPreRules preRules = new TestPreRules();
42
43 PromptBeforeValidationEvent event = new PromptBeforeValidationEvent("", "", null);
44
45 ContextSession contextSession = preRules.new ContextSession("test", event);
46
47 contextSession.askQuestion("q1", "this is q1");
48 contextSession.setAttribute("t1", "test1");
49 contextSession.setAttribute("t2", "test2");
50 contextSession.setAttribute("t3", "test3");
51
52 assertEquals("testing retrieve", "test1", contextSession.getAttribute("t1"));
53 assertEquals("testing retrieve", "test2", contextSession.getAttribute("t2"));
54 assertEquals("testing retrieve", "test3", contextSession.getAttribute("t3"));
55
56 }
57
58 }