File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 1+ = How-To test `model-api` client code without a model-server
2+ :navtitle: Test `model-api` client code without a model-server
3+
4+ If you want to test code that processes `model-api` instances, you can do this in-process without a running (light-) model-server.
5+ Use the following pattern to set up your test fixture containing `model-api` instances:
6+
7+ [source,kotlin]
8+ --
9+ val branch = ModelFacade.toLocalBranch(ModelFacade.newLocalTree())
10+ branch.runWrite {
11+ val root = branch.getRootNode()
12+ val someRootNode = root.addNewChild(null, C_SomeConcept.untyped()).typed<N_SomeConcept>()
13+ someRootNode.member.addNew(-1, C_OtherConcept).apply {
14+ name = "some test property value"
15+ }
16+ }
17+ --
18+
19+ All classes of the pattern `C_*` and `N_*` are generated using the `model-api-gen` .
Original file line number Diff line number Diff line change 11* xref:core:howto/usage-model-server.adoc[]
22* xref:core:howto/usage-model-api-gen-gradle.adoc[]
33* xref:core:howto/usage-light-model-client.adoc[]
4+ * xref:core:howto/testing-against-model-api.adoc[]
45
You can’t perform that action at this time.
0 commit comments