MockBluetoothServerBuilder

A mock implementation of BaseBluetoothServerBuilder that creates behavioral MockBluetoothServers.

createServer applies the requested BluetoothServerDSL to a fresh MockBluetoothServer (its service { } calls route to BluetoothServer.add and advertise { } to BluetoothServer.advertise), so the server's BluetoothServer.services gets populated and the generated SharedDeviceServer.sharedService lazily resolves. A test can then obtain the created instance via createdServers and drive reads/writes/subscriptions through MockBluetoothServer.triggerRead, MockBluetoothServer.triggerWrite and MockBluetoothServer.subscribe.

Parameters

setupMocks

if true the mocks are configured with sensible default behaviour

Constructors

Link copied to clipboard
constructor(setupMocks: Boolean = true)

Properties

Link copied to clipboard

A list of all MockBluetoothServers created by this builder, in creation order.

Link copied to clipboard

Functions

Link copied to clipboard
open suspend override fun createServer(settingsBuilder: (Permissions) -> ServerSettings, coroutineContext: CoroutineContext, specs: BluetoothServerDSL.() -> Unit): BluetoothServer