TestResourceScope¶
interface TestResourceScope : ResourceScope, TestDsl
A scope to combine Arrow's ResourceScope with Prepared's TestDsl.
This scope is used within tests that declare resources.
Resources declared in this scope are released at the end of the test.
Instances of this type can be obtained:
-
As a test fixture with
preparedResource -
Directly, with
resourceScope(useful for passing the test lifecycle to a component)
Additionally:
-
The
installfunctions allows binding a resource directly within a test. -
The
asPreparedfunction converts aResourceinto aPreparedvalue, Prepared's equivalent concept.
Properties¶
environment¶
abstract val environment: TestEnvironment
Functions¶
autoClose¶
bind¶
immediate¶
install¶
@IgnorableReturnValue
open fun <A : AutoCloseable> install(autoCloseable: A): A
install¶
Installs an acquire action and its matching release action.
This is a convenience equivalent of ResourceScope.install directly on the test. The behavior is identical to calling ResourceScope.install on the test's resourceScope.
External resources¶
Parameters
-
acquire: The acquire action, executed immediately.
-
release: The release action, executed at the end of the test.
See also
-
TestResourceScope: Overview of Prepared and Arrow's compatibility. -
preparedResource: Install multiple resources into aPreparedvalue. -
asPrepared: Convert aResourceinto aPreparedvalue.
Installs a Resource into the test's lifecycle scope.
The resource is immediately installed. It is released at the end of the test.
This method has identical behavior to ResourceScope.bind on the test's resourceScope. It cannot be called .bind() because this would require two receivers, and context parameters are not yet stable.
External resources¶
See also
-
TestResourceScope: Overview of Prepared and Arrow's compatibility. -
preparedResource: Install multiple resources into aPreparedvalue. -
asPrepared: Convert aResourceinto aPreparedvalue.
invoke¶
onClose¶
onRelease¶
release¶
releaseCase¶
resourceScope¶
Allows accessing the test lifecycle as an Arrow's ResourceScope.
Resources installed in the returned scope are released at the end of the test.
External resources¶
See also
-
TestResourceScope: Overview of Prepared and Arrow's compatibility. -
preparedResource: Install multiple resources into aPreparedvalue. -
asPrepared: Convert aResourceinto aPreparedvalue.