blob: 40af4b24aee9e430c88c3de88d10872ff331614e [file] [log] [blame]
<html devsite="true">
<head>
<title>VisibleForTesting</title>
{% setvar book_path %}/reference/kotlin/dokkatest/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div id="metadata-info-block"></div>
<h1>VisibleForTesting</h1>
<p>
<pre>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-retention/index.html">Retention</a>(value&nbsp;=&nbsp;AnnotationRetention.BINARY)<br>annotation <a href="/reference/kotlin/androidx/annotation/VisibleForTesting.html">VisibleForTesting</a></pre>
</p>
<hr>
<p>Denotes that the class, method or field has its visibility relaxed, so that it is more widely visible than otherwise necessary to make code testable.</p>
<p>You can optionally specify what the visibility <b>should</b> have been if not for testing; this allows tools to catch unintended access from within production code.</p>
<p>Example:</p>
<pre class="prettyprint">@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)<br>public String printDiagnostics() { ... }</pre>
<p>If not specified, the intended visibility is assumed to be private.</p>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Nested types</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code>object <a href="/reference/kotlin/androidx/annotation/VisibleForTesting.Companion.html">VisibleForTesting.Companion</a></code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code><a href="/reference/kotlin/androidx/annotation/VisibleForTesting.html#VisibleForTesting(kotlin.Int)">VisibleForTesting</a>(@<a href="/reference/kotlin/[JVM root]/&lt;Error class: unknown class&gt;.html">&lt;Error class: unknown class&gt;</a> otherwise:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public properties</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/annotation/VisibleForTesting.html#otherwise()">otherwise</a></code></div>
<p>The visibility the annotated element would have if it did not need to be made visible for testing.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="list">
<h2>Public constructors</h2>
<div class="api-item"><a name="VisibleForTesting-kotlin.Int-"></a><a name="visiblefortesting"></a>
<h3 class="api-name" id="VisibleForTesting(kotlin.Int)">VisibleForTesting</h3>
<pre class="api-signature no-pretty-print"><a href="/reference/kotlin/androidx/annotation/VisibleForTesting.html#VisibleForTesting(kotlin.Int)">VisibleForTesting</a>(@<a href="/reference/kotlin/[JVM root]/&lt;Error class: unknown class&gt;.html">&lt;Error class: unknown class&gt;</a> otherwise:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a> = PRIVATE)</pre>
</div>
</div>
<div class="list">
<h2>Public properties</h2>
<div class="api-item"><a name="getOtherwise()"></a><a name="setOtherwise()"></a><a name="getOtherwise--"></a><a name="setOtherwise--"></a>
<h3 class="api-name" id="otherwise()">otherwise</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/annotation/VisibleForTesting.html#otherwise()">otherwise</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>The visibility the annotated element would have if it did not need to be made visible for testing.</p>
</div>
</div>
</body>
</html>