|
24 | 24 | import info.novatec.testit.webtester.conditions.pagefragments.Visible; |
25 | 25 | import info.novatec.testit.webtester.conditions.pagefragments.VisibleTextContains; |
26 | 26 | import info.novatec.testit.webtester.conditions.pagefragments.VisibleTextEquals; |
| 27 | +import info.novatec.testit.webtester.conditions.syntax.Either; |
27 | 28 | import info.novatec.testit.webtester.conditions.syntax.Has; |
28 | 29 | import info.novatec.testit.webtester.conditions.syntax.Is; |
29 | 30 | import info.novatec.testit.webtester.conditions.syntax.Not; |
|
39 | 40 | @UtilityClass |
40 | 41 | public class Conditions { |
41 | 42 |
|
| 43 | + /** |
| 44 | + * Creates a new {@link Is} condition. |
| 45 | + * |
| 46 | + * @param condition the nested condition |
| 47 | + * @see Is |
| 48 | + * @since 2.0 |
| 49 | + */ |
42 | 50 | public static <T> Is<T> is(Condition<T> condition) { |
43 | 51 | return new Is<>(condition); |
44 | 52 | } |
45 | 53 |
|
| 54 | + /** |
| 55 | + * Creates a new {@link Has} condition. |
| 56 | + * |
| 57 | + * @param condition the nested condition |
| 58 | + * @see Has |
| 59 | + * @since 2.0 |
| 60 | + */ |
46 | 61 | public static <T> Has<T> has(Condition<T> condition) { |
47 | 62 | return new Has<>(condition); |
48 | 63 | } |
49 | 64 |
|
| 65 | + /** |
| 66 | + * Creates a new {@link Not} condition. |
| 67 | + * |
| 68 | + * @param condition the nested condition |
| 69 | + * @see Not |
| 70 | + * @since 2.0 |
| 71 | + */ |
50 | 72 | public static <T> Not<T> not(Condition<T> condition) { |
51 | 73 | return new Not<>(condition); |
52 | 74 | } |
53 | 75 |
|
54 | | - /* other */ |
| 76 | + /** |
| 77 | + * Creates a new {@link Either} condition. |
| 78 | + * |
| 79 | + * @param conditions the nested conditions |
| 80 | + * @see Either |
| 81 | + * @since 2.1 |
| 82 | + */ |
| 83 | + public static <T> Either<T> either(Condition<T>... conditions) { |
| 84 | + return new Either<>(conditions); |
| 85 | + } |
55 | 86 |
|
| 87 | + /** |
| 88 | + * Creates a new {@link Attribute} condition. |
| 89 | + * |
| 90 | + * @param attributeName the name of the attribute to check |
| 91 | + * @see Attribute |
| 92 | + * @since 2.0 |
| 93 | + */ |
56 | 94 | public static Attribute attribute(String attributeName) { |
57 | 95 | return new Attribute(attributeName); |
58 | 96 | } |
59 | 97 |
|
| 98 | + /** |
| 99 | + * Creates a new {@link AttributeWithValue} condition. |
| 100 | + * |
| 101 | + * @param attributeName the name of the attribute to check |
| 102 | + * @param value the value to check |
| 103 | + * @see AttributeWithValue |
| 104 | + * @since 2.0 |
| 105 | + */ |
60 | 106 | public static AttributeWithValue attributeWithValue(String attributeName, Object value) { |
61 | 107 | return new AttributeWithValue(attributeName, value); |
62 | 108 | } |
63 | 109 |
|
| 110 | + /** |
| 111 | + * Creates a new {@link Disabled} condition. |
| 112 | + * |
| 113 | + * @see Disabled |
| 114 | + * @since 2.0 |
| 115 | + */ |
64 | 116 | public static Disabled disabled() { |
65 | 117 | return new Disabled(); |
66 | 118 | } |
67 | 119 |
|
| 120 | + /** |
| 121 | + * Creates a new {@link Editable} condition. |
| 122 | + * |
| 123 | + * @see Editable |
| 124 | + * @since 2.0 |
| 125 | + */ |
68 | 126 | public static Editable editable() { |
69 | 127 | return new Editable(); |
70 | 128 | } |
71 | 129 |
|
| 130 | + /** |
| 131 | + * Creates a new {@link Enabled} condition. |
| 132 | + * |
| 133 | + * @see Enabled |
| 134 | + * @since 2.0 |
| 135 | + */ |
72 | 136 | public static Enabled enabled() { |
73 | 137 | return new Enabled(); |
74 | 138 | } |
75 | 139 |
|
| 140 | + /** |
| 141 | + * Creates a new {@link Interactable} condition. |
| 142 | + * |
| 143 | + * @see Interactable |
| 144 | + * @since 2.0 |
| 145 | + */ |
76 | 146 | public static Interactable interactable() { |
77 | 147 | return new Interactable(); |
78 | 148 | } |
79 | 149 |
|
| 150 | + /** |
| 151 | + * Creates a new {@link Invisible} condition. |
| 152 | + * |
| 153 | + * @see Invisible |
| 154 | + * @since 2.0 |
| 155 | + */ |
80 | 156 | public static Invisible invisible() { |
81 | 157 | return new Invisible(); |
82 | 158 | } |
83 | 159 |
|
| 160 | + /** |
| 161 | + * Creates a new {@link Present} condition. |
| 162 | + * |
| 163 | + * @see Present |
| 164 | + * @since 2.0 |
| 165 | + */ |
84 | 166 | public static Present present() { |
85 | 167 | return new Present(); |
86 | 168 | } |
87 | 169 |
|
| 170 | + /** |
| 171 | + * Creates a new {@link PresentAndVisible} condition. |
| 172 | + * |
| 173 | + * @see PresentAndVisible |
| 174 | + * @since 2.0 |
| 175 | + */ |
88 | 176 | public static PresentAndVisible presentAndVisible() { |
89 | 177 | return new PresentAndVisible(); |
90 | 178 | } |
91 | 179 |
|
| 180 | + /** |
| 181 | + * Creates a new {@link ReadOnly} condition. |
| 182 | + * |
| 183 | + * @see ReadOnly |
| 184 | + * @since 2.0 |
| 185 | + */ |
92 | 186 | public static ReadOnly readOnly() { |
93 | 187 | return new ReadOnly(); |
94 | 188 | } |
95 | 189 |
|
| 190 | + /** |
| 191 | + * Creates a new {@link Selected} condition. |
| 192 | + * |
| 193 | + * @see Selected |
| 194 | + * @since 2.0 |
| 195 | + */ |
96 | 196 | public static Selected selected() { |
97 | 197 | return new Selected(); |
98 | 198 | } |
99 | 199 |
|
| 200 | + /** |
| 201 | + * Creates a new {@link SelectedIndex} condition. |
| 202 | + * |
| 203 | + * @param index the expected selected index |
| 204 | + * @see SelectedIndex |
| 205 | + * @since 2.0 |
| 206 | + */ |
100 | 207 | public static SelectedIndex selectionWithIndex(Integer index) { |
101 | 208 | return new SelectedIndex(index); |
102 | 209 | } |
103 | 210 |
|
| 211 | + /** |
| 212 | + * Creates a new {@link SelectedIndices} condition. |
| 213 | + * |
| 214 | + * @param indices the expected selected indices |
| 215 | + * @see SelectedIndices |
| 216 | + * @since 2.0 |
| 217 | + */ |
104 | 218 | public static SelectedIndices selectionWithIndices(Integer... indices) { |
105 | 219 | return new SelectedIndices(indices); |
106 | 220 | } |
107 | 221 |
|
| 222 | + /** |
| 223 | + * Creates a new {@link SelectedIndices} condition. |
| 224 | + * |
| 225 | + * @param indices the expected selected indices |
| 226 | + * @see SelectedIndices |
| 227 | + * @since 2.0 |
| 228 | + */ |
108 | 229 | public static SelectedIndices selectionWithIndices(Collection<Integer> indices) { |
109 | 230 | return new SelectedIndices(indices); |
110 | 231 | } |
111 | 232 |
|
| 233 | + /** |
| 234 | + * Creates a new {@link SelectedText} condition. |
| 235 | + * |
| 236 | + * @param text the expected selected text |
| 237 | + * @see SelectedText |
| 238 | + * @since 2.0 |
| 239 | + */ |
112 | 240 | public static SelectedText selectionWithText(String text) { |
113 | 241 | return new SelectedText(text); |
114 | 242 | } |
115 | 243 |
|
| 244 | + /** |
| 245 | + * Creates a new {@link SelectedTexts} condition. |
| 246 | + * |
| 247 | + * @param texts the expected selected texts |
| 248 | + * @see SelectedTexts |
| 249 | + * @since 2.0 |
| 250 | + */ |
116 | 251 | public static SelectedTexts selectionWithTexts(String... texts) { |
117 | 252 | return new SelectedTexts(texts); |
118 | 253 | } |
119 | 254 |
|
| 255 | + /** |
| 256 | + * Creates a new {@link SelectedTexts} condition. |
| 257 | + * |
| 258 | + * @param texts the expected selected texts |
| 259 | + * @see SelectedTexts |
| 260 | + * @since 2.0 |
| 261 | + */ |
120 | 262 | public static SelectedTexts selectionWithTexts(Collection<String> texts) { |
121 | 263 | return new SelectedTexts(texts); |
122 | 264 | } |
123 | 265 |
|
| 266 | + /** |
| 267 | + * Creates a new {@link SelectedValue} condition. |
| 268 | + * |
| 269 | + * @param value the expected selected value |
| 270 | + * @see SelectedValue |
| 271 | + * @since 2.0 |
| 272 | + */ |
124 | 273 | public static SelectedValue selectionWithValue(String value) { |
125 | 274 | return new SelectedValue(value); |
126 | 275 | } |
127 | 276 |
|
| 277 | + /** |
| 278 | + * Creates a new {@link SelectedValues} condition. |
| 279 | + * |
| 280 | + * @param values the expected selected values |
| 281 | + * @see SelectedValues |
| 282 | + * @since 2.0 |
| 283 | + */ |
128 | 284 | public static SelectedValues selectionWithValues(String... values) { |
129 | 285 | return new SelectedValues(values); |
130 | 286 | } |
131 | 287 |
|
| 288 | + /** |
| 289 | + * Creates a new {@link SelectedValues} condition. |
| 290 | + * |
| 291 | + * @param values the expected selected values |
| 292 | + * @see SelectedValues |
| 293 | + * @since 2.0 |
| 294 | + */ |
132 | 295 | public static SelectedValues selectionWithValues(Collection<String> values) { |
133 | 296 | return new SelectedValues(values); |
134 | 297 | } |
135 | 298 |
|
| 299 | + /** |
| 300 | + * Creates a new {@link Visible} condition. |
| 301 | + * |
| 302 | + * @see Visible |
| 303 | + * @since 2.0 |
| 304 | + */ |
136 | 305 | public static Visible visible() { |
137 | 306 | return new Visible(); |
138 | 307 | } |
139 | 308 |
|
| 309 | + /** |
| 310 | + * Creates a new {@link VisibleTextEquals} condition. |
| 311 | + * |
| 312 | + * @param text the expected visible text |
| 313 | + * @see VisibleTextEquals |
| 314 | + * @since 2.0 |
| 315 | + */ |
140 | 316 | public static VisibleTextEquals visibleText(String text) { |
141 | 317 | return new VisibleTextEquals(text); |
142 | 318 | } |
143 | 319 |
|
| 320 | + /** |
| 321 | + * Creates a new {@link VisibleTextContains} condition. |
| 322 | + * |
| 323 | + * @param partialText the expected visible partial text |
| 324 | + * @see VisibleTextContains |
| 325 | + * @since 2.0 |
| 326 | + */ |
144 | 327 | public static VisibleTextContains visibleTextContaining(String partialText) { |
145 | 328 | return new VisibleTextContains(partialText); |
146 | 329 | } |
|
0 commit comments