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.rule.event.PromptBeforeValidationEvent;
20 import org.kuali.rice.kns.rules.PromptBeforeValidationBase;
21 import org.kuali.rice.krad.document.Document;
22 import org.kuali.rice.krad.maintenance.MaintenanceDocument;
23 import org.kuali.rice.kns.rules.PromptBeforeValidationBase.ContextSession;
24
25 import static org.junit.Assert.assertEquals;
26
27 public class PromptBeforeValidationContinuationBaseTest {
28
29 private class TestPreRules extends PromptBeforeValidationBase {
30 @Override
31 public boolean doPrompts(Document document) {
32 MaintenanceDocument maintenanceDocument = (MaintenanceDocument) document;
33 return false;
34 }
35
36 }
37
38 @Test public void test() {
39
40 TestPreRules preRules = new TestPreRules();
41
42 PromptBeforeValidationEvent event = new PromptBeforeValidationEvent("", "", null);
43
44 ContextSession contextSession = preRules.new ContextSession("test", event);
45
46 contextSession.askQuestion("q1", "this is q1");
47 contextSession.setAttribute("t1", "test1");
48 contextSession.setAttribute("t2", "test2");
49 contextSession.setAttribute("t3", "test3");
50
51 assertEquals("testing retrieve", "test1", contextSession.getAttribute("t1"));
52 assertEquals("testing retrieve", "test2", contextSession.getAttribute("t2"));
53 assertEquals("testing retrieve", "test3", contextSession.getAttribute("t3"));
54
55 }
56
57 }