1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.webphotos.gui.util.uispec4j;
17
18 import static org.junit.Assert.assertTrue;
19 import org.uispec4j.Trigger;
20 import org.uispec4j.Window;
21 import org.uispec4j.interception.WindowHandler;
22
23
24
25
26
27 public class ModalWindowHandler extends WindowHandler {
28
29 private String titleName;
30 private String modalText;
31
32
33
34
35
36
37 public ModalWindowHandler(String titleName, String modalText) {
38 this.modalText = modalText;
39 this.titleName = titleName;
40 }
41
42
43
44
45
46
47
48 @Override
49 public Trigger process(Window window) throws Exception {
50 assertTrue("Tittle: " + window.getTitle(), window.titleContains(titleName).isTrue());
51 assertTrue("Modal: " + window.getTitle(), window.isModal().isTrue());
52 window.getInputTextBox().setText(modalText);
53 return window.getButton("OK").triggerClick();
54 }
55
56 }