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 public HtmlRenderedAttr(String name, String value)
45 {
46 this.name = name;
47 this.value = value;
48 this.expectedHtml = " "+name+"=\""+value+"\"";
49
50 renderSuccessful = false;
51 expectedOccurrences = 1;
52 }
53
54
55
56
57
58
59
60
61
62 public HtmlRenderedAttr(String name, String value, String expectedHtml) {
63 this.name = name;
64 this.value = value;
65 this.expectedHtml = expectedHtml;
66
67 renderSuccessful = false;
68 expectedOccurrences = 1;
69 }
70
71 public HtmlRenderedAttr(String name, String value, String expectedHtml, int occurances) {
72 this(name, value, expectedHtml);
73 this.expectedOccurrences = occurances;
74 }
75
76 public String getName()
77 {
78 return name;
79 }
80
81 public void setName(String name)
82 {
83 this.name = name;
84 }
85
86 public String getValue()
87 {
88 return value;
89 }
90
91 public void setValue(String value)
92 {
93 this.value = value;
94 }
95
96 public String getExpectedHtml()
97 {
98 return expectedHtml;
99 }
100
101 public void setExpectedHtml(String expectedHtml)
102 {
103 this.expectedHtml = expectedHtml;
104 }
105
106
107
108
109
110
111
112
113 public boolean isRenderSuccessful()
114 {
115 return renderSuccessful;
116 }
117
118 public void setRenderSuccessful(boolean renderSuccessful)
119 {
120 this.renderSuccessful = renderSuccessful;
121 }
122
123 public int getErrorCode()
124 {
125 return errorCode;
126 }
127
128 public void setErrorCode(int errorCode)
129 {
130 this.errorCode = errorCode;
131 setRenderSuccessful(false);
132 }
133
134 public void increaseActualOccurrences() {
135 actualOccurrences++;
136 }
137
138 public int getActualOccurrences() {
139 return this.actualOccurrences;
140 }
141
142 public int getExpectedOccurrences() {
143 return this.expectedOccurrences;
144 }
145 }