Skip to content

Commit 8e26cd9

Browse files
committed
Doc edits around Reuse Config
Signed-off-by: Gopal S Akshintala <[email protected]>
1 parent b62e44a commit 8e26cd9

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

README.adoc

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,30 @@ include::{integrationtestdir}/com/salesforce/revoman/integration/core/pq/PQE2EWi
339339
<14> Run more assertions on the <<Rundown>>
340340
endif::[]
341341

342-
== Reuse Config
342+
== Config
343343

344-
You can define a base common config and reuse it by overriding certain properties using the `override...()` methods,
345-
which are present for each config attribute
344+
[.lead]
345+
Config built using `Kick.configure()` is *Immutable*.
346+
347+
When there are many tests leveraging the same config with minor modifications, You can define a common config and add your variations (like add more hooks),
348+
using `override...()` methods,
349+
which are present for all config attributes, to create a new instance of config.
350+
351+
CAUTION: The new instance created from common config using `override...()` replaces the attributes.
352+
353+
* For iterable attributes (like `List`, `Map` etc), intentionally there are no methods to `add` or `append` or `prepend` attributes when creating new instance, to prevent any mix-up with the order of attributes. You can use any collection appending utilities to prepend/append previous hooks.
354+
355+
[source,java,indent=0,tabsize=2,options="nowrap"]
356+
----
357+
POKEMON_COMMON_CONFIG.overrideHooks(kotlin.collections.SetsKt.plus(POKEMON_COMMON_CONFIG.hooks(), post(.../*My Hooks*/))
358+
----
359+
360+
* However, you can construct a new instance by accumulating attributes from other instances using `from()` method, like below
361+
362+
[source,java,indent=0,tabsize=2,options="nowrap"]
363+
----
364+
Kick.configure().from(configInstance1).from(configInstance2)...off();
365+
----
346366

347367
[#_debugging_dx]
348368
== Troubleshooting DX

0 commit comments

Comments
 (0)