1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.jameleon.plugin.jagacy.tags;
20
21 import net.sf.jameleon.plugin.jagacy.JagacyFunctionTag;
22
23 /***
24 * Verifies that the given text exists on the screen or on the provided row if defined.
25 * @jameleon.function name="jagacy-validate-text-present" type="validation"
26 */
27 public class JagacyValidateTextPresentTag extends JagacyFunctionTag{
28
29 /***
30 * The text that should exist on the screen
31 * @jameleon.attribute required="true"
32 */
33 protected String text;
34 /***
35 * The row number that the text should exist on.
36 * If not set, then the entire screen is searched.
37 * @jameleon.attribute
38 */
39 protected Integer row;
40
41 public void testBlock(){
42 if (row == null) {
43 assertTextPresent(text);
44 }else{
45 String[] lines = readScreen();
46 if (lines != null && lines.length > 0) {
47 String lineToValide = lines[row.intValue()];
48 assertTextContains("'"+text+"' not in text in row # "+row.intValue(), lineToValide, text);
49 }
50 }
51 }
52 }