Repository: deltaspike Updated Branches: refs/heads/master 38bc9c3d3 -> a95c0bc6f
DELTASPIKE-1298 initial hints about MockFilter and customizing the DynamicMockManager Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/a95c0bc6 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/a95c0bc6 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/a95c0bc6 Branch: refs/heads/master Commit: a95c0bc6f4b202648a7d9c87ca28a36ad3084e88 Parents: 38bc9c3 Author: gpetracek <gpetra...@apache.org> Authored: Tue Oct 31 19:44:21 2017 +0100 Committer: gpetracek <gpetra...@apache.org> Committed: Tue Oct 31 19:44:21 2017 +0100 ---------------------------------------------------------------------- .../src/main/asciidoc/test-control.adoc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/a95c0bc6/documentation/src/main/asciidoc/test-control.adoc ---------------------------------------------------------------------- diff --git a/documentation/src/main/asciidoc/test-control.adoc b/documentation/src/main/asciidoc/test-control.adoc index ce877c8..2ed48f0 100644 --- a/documentation/src/main/asciidoc/test-control.adoc +++ b/documentation/src/main/asciidoc/test-control.adoc @@ -586,6 +586,26 @@ jar { == SPI +=== MockFilter + +Please make sure that you are aware of <<__MockFrameworks, Integration of Mock Frameworks>> before you continue with this section. + +If you would like to exclude some parts of your application- and/or test-code +so that they arenât eligible for the mocking mechanism, +you can provide an own implementation of `org.apache.deltaspike.testcontrol.spi.mock.MockFilter` and +register it in `/META-INF/services/org.apache.deltaspike.testcontrol.spi.mock.MockFilter`. + +That's quite special and you need to know the CDI-SPI a bit. +To get an idea about the required steps, you can have a look at the default implementation used by DeltaSpike-Test itself. + +Such a filter is also needed in case you would like to customize DeltaSpike-Test. +For example to provide an `@Alternative` implementation for DynamicMockManager, +you need to implement `org.apache.deltaspike.testcontrol.api.mock.DynamicMockManager`, annotate it with `@Alternative`, +ensure that you keep the type-information with `@Typed`, +configure the alternative bean in `/META-INF/beans.xml` (in the test-classpath) and +provide a custom `MockFilter` (as described above) which excludes the custom mock-manager. +(Otherwise DeltaSpike-Test will try to mock the custom mock-manager.) + === ExternalContainer org.apache.deltaspike.testcontrol.spi.ExternalContainer allows to