1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.test.utils;
20
21 public class HtmlRenderedAttr
22 {
23 public static final int RENDERED_MORE_TIMES_THAN_EXPECTED = 1;
24 public static final int RENDERED_LESS_TIMES_THAN_EXPECTED = 2;
25
26 private String name;
27 private String value;
28 private String expectedHtml;
29 private boolean renderSuccessful;
30 private int errorCode;
31 private int expectedOccurrences;
32 private int actualOccurrences;
33
34 public HtmlRenderedAttr(String name) {
35 this(name, name, name + "=\"" + name + "\"");
36 expectedOccurrences = 1;
37 }
38
39 public HtmlRenderedAttr(String name, int expectedOccurences) {
40 this(name);
41 this.expectedOccurrences = expectedOccurences;
42 }
43
44
45
46
47
48
49
50
51
52 public HtmlRenderedAttr(String name, String value, String expectedHtml) {
53 this.name = name;
54 this.value = value;
55 this.expectedHtml = expectedHtml;
56
57 renderSuccessful = false;
58 expectedOccurrences = 1;
59 }
60
61 public HtmlRenderedAttr(String name, String value, String expectedHtml, int occurances) {
62 this(name, value, expectedHtml);
63 this.expectedOccurrences = occurances;
64 }
65
66 public String getName()
67 {
68 return name;
69 }
70
71 public void setName(String name)
72 {
73 this.name = name;
74 }
75
76 public String getValue()
77 {
78 return value;
79 }
80
81 public void setValue(String value)
82 {
83 this.value = value;
84 }
85
86 public String getExpectedHtml()
87 {
88 return expectedHtml;
89 }
90
91 public void setExpectedHtml(String expectedHtml)
92 {
93 this.expectedHtml = expectedHtml;
94 }
95
96
97
98
99
100
101
102
103 public boolean isRenderSuccessful()
104 {
105 return renderSuccessful;
106 }
107
108 public void setRenderSuccessful(boolean renderSuccessful)
109 {
110 this.renderSuccessful = renderSuccessful;
111 }
112
113 public int getErrorCode()
114 {
115 return errorCode;
116 }
117
118 public void setErrorCode(int errorCode)
119 {
120 this.errorCode = errorCode;
121 setRenderSuccessful(false);
122 }
123
124 public void increaseActualOccurrences() {
125 actualOccurrences++;
126 }
127
128 public int getActualOccurrences() {
129 return this.actualOccurrences;
130 }
131
132 public int getExpectedOccurrences() {
133 return this.expectedOccurrences;
134 }
135 }