<!DOCTYPE html> <html lang="en"> <head> <title>Supported features Reference</title> <link rel="stylesheet" type="text/css" href="css/jazzy.css" /> <link rel="stylesheet" type="text/css" href="css/highlight.css" /> <meta charset='utf-8'> <script src="js/jquery.min.js" defer></script> <script src="js/jazzy.js" defer></script> </head> <body> <a title="Supported features Reference"></a> <header> <div class="content-wrapper"> <p><a href="index.html">SwiftyMocky 4.1.0-pre Docs</a> (86% documented)</p> <p class="header-right"><a href="https://github.com/MakeAWishFoundation/SwiftyMocky"><img src="img/gh.png"/>View on GitHub</a></p> </div> </header> <div class="content-wrapper"> <p id="breadcrumbs"> <a href="index.html">SwiftyMocky Reference</a> <img id="carat" src="img/carat.png" /> Supported features Reference </p> </div> <div class="content-wrapper"> <nav class="sidebar"> <ul class="nav-groups"> <li class="nav-group-name"> <a href="Main%20Guides.html">Main Guides</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="overview.html">Overview</a> </li> <li class="nav-group-task"> <a href="installation.html">Installation</a> </li> <li class="nav-group-task"> <a href="setup-in-project.html">Setup in project</a> </li> <li class="nav-group-task"> <a href="mockfile.html">Mockfile</a> </li> <li class="nav-group-task"> <a href="command-line-interface.html">Command Line Interface</a> </li> <li class="nav-group-task"> <a href="supported-features.html">Supported features</a> </li> <li class="nav-group-task"> <a href="prototyping.html">Prototyping</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Additional%20Guides.html">Additional Guides</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="matcher-support-for-not-equatable.html">Matcher support for not Equatable</a> </li> <li class="nav-group-task"> <a href="handling-generics.html">Handling Generics</a> </li> <li class="nav-group-task"> <a href="examples.html">Examples</a> </li> <li class="nav-group-task"> <a href="legacy.html">Legacy</a> </li> <li class="nav-group-task"> <a href="add-xcode-generate-action.html">Add XCode generate action</a> </li> <li class="nav-group-task"> <a href="known-issues.html">Known issues</a> </li> <li class="nav-group-task"> <a href="changelog.html">CHANGELOG</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Global%20methods.html">Global methods</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="Global%20methods.html#/s:11SwiftyMocky5Givenyyx_ABQzAA14StubbingPolicyOtAA4MockRzlF">Given(_:_:_:)</a> </li> <li class="nav-group-task"> <a href="Global%20methods.html#/s:11SwiftyMocky5Givenyyxm_06StaticC0QzAA14StubbingPolicyOtAA0D4MockRzlF">Given(_:_:_:)</a> </li> <li class="nav-group-task"> <a href="Global%20methods.html#/s:11SwiftyMocky7Performyyx_ABQztAA4MockRzlF">Perform(_:_:)</a> </li> <li class="nav-group-task"> <a href="Global%20methods.html#/s:11SwiftyMocky7Performyyxm_06StaticC0QztAA0D4MockRzlF">Perform(_:_:)</a> </li> <li class="nav-group-task"> <a href="Global%20methods.html#/s:11SwiftyMocky6Verify__4file4lineyx_ABQzs12StaticStringVSutAA4MockRzlF">Verify(_:_:file:line:)</a> </li> <li class="nav-group-task"> <a href="Global%20methods.html#/s:11SwiftyMocky6Verify__4file4lineyxm_06StaticC0Qzs0F6StringVSutAA0F4MockRzlF">Verify(_:_:file:line:)</a> </li> <li class="nav-group-task"> <a href="Global%20methods.html#/s:11SwiftyMocky6Verify___4file4lineyx_AA5CountOABQzs12StaticStringVSutAA4MockRzlF">Verify(_:_:_:file:line:)</a> </li> <li class="nav-group-task"> <a href="Global%20methods.html#/s:11SwiftyMocky6Verify___4file4lineyxm_AA5CountO06StaticC0Qzs0G6StringVSutAA0G4MockRzlF">Verify(_:_:_:file:line:)</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Configuration.html">Configuration</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="Enums/StubbingPolicy.html">StubbingPolicy</a> </li> <li class="nav-group-task"> <a href="Enums/SequencingPolicy.html">SequencingPolicy</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Types.html">Types</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="Protocols/Mock.html">Mock</a> </li> <li class="nav-group-task"> <a href="Protocols/StaticMock.html">StaticMock</a> </li> <li class="nav-group-task"> <a href="Enums/Parameter.html">Parameter</a> </li> <li class="nav-group-task"> <a href="Classes/Matcher.html">Matcher</a> </li> <li class="nav-group-task"> <a href="Classes/Matcher/ComparisonResult.html">– ComparisonResult</a> </li> <li class="nav-group-task"> <a href="Classes/Matcher/ParameterComparisonResult.html">– ParameterComparisonResult</a> </li> <li class="nav-group-task"> <a href="Protocols/Countable.html">Countable</a> </li> <li class="nav-group-task"> <a href="Enums/Count.html">Count</a> </li> <li class="nav-group-task"> <a href="Structs/Stubber.html">Stubber</a> </li> <li class="nav-group-task"> <a href="Structs/StubberThrows.html">StubberThrows</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Generics.html">Generics</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="Structs/GenericAttribute.html">GenericAttribute</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Helpers.html">Helpers</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="Helpers.html#/s:11SwiftyMocky20XCTAssertThrowsError_2of_4file4lineyxyKXK_q_mSSyXKs12StaticStringVSuts0E0R_r0_lF">XCTAssertThrowsError(_:of:_:file:line:)</a> </li> <li class="nav-group-task"> <a href="Helpers.html#/s:11SwiftyMocky20XCTAssertThrowsError_5error_4file4lineyxyKXK_q_SSyXKs12StaticStringVSutSQR_s0E0R_r0_lF">XCTAssertThrowsError(_:error:_:file:line:)</a> </li> <li class="nav-group-task"> <a href="Classes/MockyAssertion.html">MockyAssertion</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Internal.html">Internal</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="Classes/SwiftyMockyTestObserver.html">SwiftyMockyTestObserver</a> </li> <li class="nav-group-task"> <a href="Classes/SwiftyMockyTestObserver.html">SwiftyMockyTestObserver</a> </li> <li class="nav-group-task"> <a href="Structs/FatalErrorUtil.html">FatalErrorUtil</a> </li> <li class="nav-group-task"> <a href="Protocols/WithSequencingPolicy.html">WithSequencingPolicy</a> </li> <li class="nav-group-task"> <a href="Protocols/WithStaticSequencingPolicy.html">WithStaticSequencingPolicy</a> </li> <li class="nav-group-task"> <a href="Protocols/WithStubbingPolicy.html">WithStubbingPolicy</a> </li> <li class="nav-group-task"> <a href="Extensions/Int.html">Int</a> </li> <li class="nav-group-task"> <a href="Extensions/Optional.html">Optional</a> </li> <li class="nav-group-task"> <a href="Extensions/UInt.html">UInt</a> </li> <li class="nav-group-task"> <a href="Enums/MockError.html">MockError</a> </li> <li class="nav-group-task"> <a href="Enums/StubProduct.html">StubProduct</a> </li> <li class="nav-group-task"> <a href="Classes/StubbedMethod.html">StubbedMethod</a> </li> <li class="nav-group-task"> <a href="Internal.html#/s:11SwiftyMocky7Failureys5NeverOSSF">Failure(_:)</a> </li> <li class="nav-group-task"> <a href="Internal.html#/s:11SwiftyMocky0B6Assert__4file4lineySbyXK_SSyXKs12StaticStringVSutF">MockyAssert(_:_:file:line:)</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Other%20Guides.html">Other Guides</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="contents.html">Contents</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Other%20Classes.html">Other Classes</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="Classes/ArgumentCaptor.html">ArgumentCaptor</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Other%20Enums.html">Other Enumerations</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="Enums/MockScope.html">MockScope</a> </li> <li class="nav-group-task"> <a href="Enums/Utils.html">Utils</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Other%20Protocols.html">Other Protocols</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="Protocols/TypeErasedValue.html">TypeErasedValue</a> </li> </ul> </li> <li class="nav-group-name"> <a href="Other%20Structs.html">Other Structures</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="Structs/TypeErasedAttribute.html">TypeErasedAttribute</a> </li> </ul> </li> </ul> </nav> <article class="main-content"> <section> <section class="section"> <h1 id='supported-features' class='heading'>Supported features</h1> <h2 id='generation' class='heading'>Generation:</h2> <p>All supported ways of generating mocks. Handling mockable types:</p> <ul> <li>[x] generating inline mocks</li> <li>[x] generate in Mocked.generated based on AutoMockable protocol</li> <li>[x] generate in Mocked.generated based on AutoMockable annotation</li> <li>[ ] skip protocols that cannot be generated with warning</li> <li>[x] support protocol inheritance</li> <li>[x] support objc protocols (with special protocol/annotation)</li> <li>[x] support generic protocols - see <strong>Generics</strong> section for more information <strong>!!!</strong></li> </ul> <h2 id='stubbing' class='heading'>Stubbing:</h2> <p>Support for stubbing protocol members:</p> <ul> <li>[x] stubbing initializers <strong>only for protocol conformance - they have empty implementation!</strong></li> <li>[ ] stubbing deinitializers</li> <li>[x] stubbing instance methods <ul> <li>[x] with return value</li> <li>[ ] with return as Swift.Never</li> <li>[x] that throws</li> <li>[x] that rethrows</li> </ul></li> <li>[x] stubbing static methods</li> <li>[x] stubbing generic methods <ul> <li>[x] constrained to protocol conformance</li> <li>[x] with ‘T.Type’ attributes</li> <li>[x] constrained to Self type</li> </ul></li> <li>[x] stubbing variables (with get, set) <ul> <li>[x] instance variables</li> <li>[x] static variables</li> <li>[x] optional</li> <li>[x] implicitly unwrapped optional</li> </ul></li> <li>[x] stubbing subscripts - <strong>for generic subscripts manual annotation needed</strong></li> <li>[x] handling associated types - <strong>done by annotations</strong></li> <li>[x] handling conformances in associated types</li> <li>[x] wrapping method attributes as Parameter <ul> <li>[x] basic types</li> <li>[x] closures</li> <li>[x] @escaping closures</li> <li>[x] typealiases</li> </ul></li> </ul> <h2 id='given' class='heading'>Given</h2> <p>Usage of Given to specify return value and error thrown for stubbed methods:</p> <ul> <li>[x] constraint to attributes matching <code>.any</code></li> <li>[x] constraint to attributes matching explicit <code>.value(ValueType)</code> where: <ul> <li>[x] ValueType is Equatable</li> <li>[x] ValueType is Sequences of Equatable elements</li> <li>[x] ValueType is not Equatable - <strong>when registered comparator in Matcher</strong></li> <li>[x] ValueType is Equatable is <code>@escaping</code> closure - <strong>when registered comparator in Matcher</strong></li> <li>[x] <strong>!!!</strong> ValueType is not <code>@escaping</code> closure - <strong>always handled as</strong> <code>.any</code></li> </ul></li> <li>[x] return value for instance stub</li> <li>[x] error thrown for instance stub</li> <li>[ ] error thrown for instance stubs that rethrows</li> <li>[x] return value for static stubs</li> <li>[x] error thrown for static stubs</li> <li>[ ] error thrown for static stubs, that rethrows</li> </ul> <h2 id='perform' class='heading'>Perform</h2> <p>Usage of Perform to execute closure, when stubbed method is called:</p> <ul> <li>[x] perform closure attributes matching stub attributes</li> <li>[x] constraint to attributes matching <code>.any</code></li> <li>[x] constraint to attributes matching explicit <code>.value(ValueType)</code> where: <ul> <li>[x] ValueType is Equatable</li> <li>[x] ValueType is Sequences of Equatable elements</li> <li>[x] ValueType is not Equatable - <strong>when registered comparator in Matcher</strong></li> <li>[x] ValueType is Equatable is <code>@escaping</code> closure - <strong>when registered comparator in Matcher</strong></li> <li>[x] <strong>!!!</strong> ValueType is not <code>@escaping</code> closure - <strong>always handled as</strong> <code>.any</code></li> </ul></li> <li>[x] expect perform closure for static stubs</li> </ul> <h2 id='verify' class='heading'>Verify</h2> <p>Usage of Verify to check, whether specific stubbed method was called on Mock</p> <ul> <li>[x] constraint to attributes matching <code>.any</code></li> <li>[x] constraint to attributes matching explicit <code>.value(ValueType)</code> where: <ul> <li>[x] ValueType is Equatable</li> <li>[x] ValueType is Sequences of Equatable elements</li> <li>[x] ValueType is not Equatable - <strong>when registered comparator in Matcher</strong></li> <li>[x] ValueType is Equatable is <code>@escaping</code> closure - <strong>when registered comparator in Matcher</strong></li> <li>[x] <strong>!!!</strong> ValueType is not <code>@escaping</code> closure - <strong>always handled as</strong> <code>.any</code></li> </ul></li> <li>[x] verify if called at least once</li> <li>[x] verify if called exactly number of times</li> <li>[x] verify for static methods</li> </ul> </section> </section> <section id="footer"> <p>Copyright © 2017 MakeAWishFoundation. All rights reserved.</p> <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.11.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p> </section> </article> </div> </body> </div> </html>