1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119<!DOCTYPE html>
120<html devsite>
121<head>
122
123
124    <meta name="top_category" value="develop" />
125
126    <meta name="subcategory" value="reference" />
127
128
129      <meta name="book_path" value="/reference/android/support/test/_book.yaml" />
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145<title>ViewAssertion</title>
146
147
148</head>
149
150<body class="gc-documentation develop reference api apilevel-">
151<div id="doc-api-level" class="" style="display:none"></div>
152
153
154
155
156<div id="naMessage"></div>
157
158<div id="api-info-block">
159<div class="api-level">
160
161
162
163
164</div>
165
166
167
168
169<div class="sum-details-links">
170
171</div><!-- end sum-details-links -->
172</div><!-- end api-info-block -->
173
174<div class="api apilevel-" id="jd-content">
175
176<!-- ======== START OF CLASS DATA ======== -->
177
178<h1 class="api-title">ViewAssertion</h1>
179<p>
180<code class="api-signature">
181  public
182
183
184
185  interface
186  ViewAssertion
187</code>
188<br>
189
190
191<code class="api-signature">
192
193
194
195</code>
196
197</p><table class="jd-inheritance-table">
198
199
200  <tr>
201
202    <td colspan="1" class="jd-inheritance-class-cell">android.support.test.espresso.ViewAssertion
203    </td>
204  </tr>
205
206
207</table>
208
209
210
211
212<br><hr>
213
214
215  <p>Responsible for performing assertions on a View element.<br>
216 <p>
217 This is considered part of the test framework public API - developers are free to write their own
218 assertions as long as they meet the following requirements:
219 <ul>
220 <li>Do not mutate the passed in view.
221 <li>Throw junit.framework.AssertionError when the view assertion does not hold.
222 <li>Implementation runs on the UI thread - so it should not do any blocking operations
223 <li>Downcasting the view to a specific type is allowed, provided there is a test that view is an
224 instance of that type before downcasting. If not, an AssertionError should be thrown.
225 <li>It is encouraged to access non-mutating methods on the view to perform assertion.
226 </ul>
227 <br>
228 <p>
229 Strongly consider using a existing ViewAssertion via the ViewAssertions utility class before
230 writing your own assertion.
231</p>
232
233
234
235
236
237
238
239<h2 class="api-section">Summary</h2>
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267<!-- ========== METHOD SUMMARY =========== -->
268<table id="pubmethods" class="responsive methods">
269<tr><th colspan="2"><h3>Public methods</h3></th></tr>
270
271
272
273
274  <tr class="api apilevel-" >
275
276
277    <td><code>
278        abstract
279
280
281
282
283        void</code>
284    </td>
285
286    <td width="100%">
287      <code>
288      <a href="/reference/android/support/test/espresso/ViewAssertion.html#check(android.view.View, android.support.test.espresso.NoMatchingViewException)">check</a>(View view, <a href="/reference/android/support/test/espresso/NoMatchingViewException.html">NoMatchingViewException</a> noViewFoundException)
289      </code>
290
291        <p>Checks the state of the given view (if such a view is present).
292
293
294</p>
295
296    </td>
297  </tr>
298
299
300
301</table>
302
303
304
305
306
307
308
309
310<!-- XML Attributes -->
311
312
313<!-- Enum Values -->
314
315
316<!-- Constants -->
317
318
319<!-- Fields -->
320
321
322<!-- Public ctors -->
323
324
325
326<!-- ========= CONSTRUCTOR DETAIL ======== -->
327<!-- Protected ctors -->
328
329
330
331<!-- ========= METHOD DETAIL ======== -->
332<!-- Public methdos -->
333
334<h2 class="api-section">Public methods</h2>
335
336
337
338<A NAME="check(android.view.View, android.support.test.espresso.NoMatchingViewException)"></A>
339
340<div class="api apilevel-">
341    <h3 class="api-name">check</h3>
342    <div class="api-level">
343      <div></div>
344
345
346
347    </div>
348<pre class="api-signature no-pretty-print">
349void check (View view,
350                <a href="/reference/android/support/test/espresso/NoMatchingViewException.html">NoMatchingViewException</a> noViewFoundException)</pre>
351
352
353
354
355  <p>Checks the state of the given view (if such a view is present).</p>
356    <table class="responsive">
357    <tr><th colspan=2>Parameters</th></tr>
358      <tr>
359        <td><code>view</code></td>
360        <td width="100%">
361          <code>View</code>:
362          the view, if one was found during the view interaction or null if it was not
363 (which may be an acceptable option for an assertion)</td>
364      </tr>
365      <tr>
366        <td><code>noViewFoundException</code></td>
367        <td width="100%">
368          <code>NoMatchingViewException</code>:
369          an exception detailing why the view could not be found or null if
370 the view was found
371</td>
372      </tr>
373    </table>
374
375</div>
376
377
378
379
380
381<!-- ========= METHOD DETAIL ======== -->
382
383
384
385<!-- ========= END OF CLASS DATA ========= -->
386
387</div><!-- end jd-content -->
388
389
390
391<div class="data-reference-resources-wrapper">
392
393  <ul data-reference-resources>
394
395
396    <li><h2>Interfaces</h2>
397      <ul>
398          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/BaseLayerComponent.html">BaseLayerComponent</a></li>
399          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/EspressoException.html">EspressoException</a></li>
400          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/FailureHandler.html">FailureHandler</a></li>
401          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/IdlingResource.html">IdlingResource</a></li>
402          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/IdlingResource.ResourceCallback.html">IdlingResource.ResourceCallback</a></li>
403          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/UiController.html">UiController</a></li>
404          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/ViewAction.html">ViewAction</a></li>
405          <li class="selected api apilevel-"><a href="/reference/android/support/test/espresso/ViewAssertion.html">ViewAssertion</a></li>
406          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/ViewFinder.html">ViewFinder</a></li>
407          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/ViewInteractionComponent.html">ViewInteractionComponent</a></li>
408      </ul>
409    </li>
410
411    <li><h2>Classes</h2>
412      <ul>
413          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/AmbiguousViewMatcherException.Builder.html">AmbiguousViewMatcherException.Builder</a></li>
414          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/DataInteraction.html">DataInteraction</a></li>
415          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/Espresso.html">Espresso</a></li>
416          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/GraphHolder.html">GraphHolder</a></li>
417          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/IdlingPolicies.html">IdlingPolicies</a></li>
418          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/IdlingPolicy.html">IdlingPolicy</a></li>
419          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/NoMatchingViewException.Builder.html">NoMatchingViewException.Builder</a></li>
420          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/PerformException.Builder.html">PerformException.Builder</a></li>
421          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/Root.html">Root</a></li>
422          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/Root.Builder.html">Root.Builder</a></li>
423          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a></li>
424      </ul>
425    </li>
426
427
428    <li><h2>Exceptions</h2>
429      <ul>
430          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/AmbiguousViewMatcherException.html">AmbiguousViewMatcherException</a></li>
431          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/AppNotIdleException.html">AppNotIdleException</a></li>
432          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/IdlingResourceTimeoutException.html">IdlingResourceTimeoutException</a></li>
433          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/InjectEventSecurityException.html">InjectEventSecurityException</a></li>
434          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/NoActivityResumedException.html">NoActivityResumedException</a></li>
435          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/NoMatchingRootException.html">NoMatchingRootException</a></li>
436          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/NoMatchingViewException.html">NoMatchingViewException</a></li>
437          <li class="api apilevel-"><a href="/reference/android/support/test/espresso/PerformException.html">PerformException</a></li>
438      </ul>
439    </li>
440
441  </ul>
442
443</div>
444
445
446
447</body>
448</html>
449