diff --git a/docs/source/example-code/src/main/kotlin/net/corda/docs/tutorial/testdsl/TutorialTestDSL.kt b/docs/source/example-code/src/main/kotlin/net/corda/docs/tutorial/testdsl/TutorialTestDSL.kt index 2b25fe726e..a52961b0e0 100644 --- a/docs/source/example-code/src/main/kotlin/net/corda/docs/tutorial/testdsl/TutorialTestDSL.kt +++ b/docs/source/example-code/src/main/kotlin/net/corda/docs/tutorial/testdsl/TutorialTestDSL.kt @@ -31,7 +31,7 @@ class CommercialPaperTest { transaction { attachments(CP_PROGRAM_ID) input(CP_PROGRAM_ID) { inState } - this.verifies() + verifies() } } } @@ -46,7 +46,7 @@ class CommercialPaperTest { input(CP_PROGRAM_ID) { inState } command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Move() } attachments(CP_PROGRAM_ID) - this.verifies() + verifies() } } } @@ -61,7 +61,7 @@ class CommercialPaperTest { input(CP_PROGRAM_ID) { inState } command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Move() } attachments(CP_PROGRAM_ID) - this `fails with` "the state is propagated" + `fails with`("the state is propagated") } } } @@ -76,9 +76,9 @@ class CommercialPaperTest { input(CP_PROGRAM_ID) { inState } command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Move() } attachments(CP_PROGRAM_ID) - this `fails with` "the state is propagated" + `fails with`("the state is propagated") output(CP_PROGRAM_ID, "alice's paper") { inState.withOwner(ALICE) } - this.verifies() + verifies() } } } @@ -95,11 +95,11 @@ class CommercialPaperTest { // The wrong pubkey. command(BIG_CORP_PUBKEY) { CommercialPaper.Commands.Issue() } timeWindow(TEST_TX_TIME) - this `fails with` "output states are issued by a command signer" + `fails with`("output states are issued by a command signer") } command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Issue() } timeWindow(TEST_TX_TIME) - this.verifies() + verifies() } } } @@ -115,11 +115,11 @@ class CommercialPaperTest { // The wrong pubkey. command(BIG_CORP_PUBKEY) { CommercialPaper.Commands.Issue() } timeWindow(TEST_TX_TIME) - this `fails with` "output states are issued by a command signer" + `fails with`("output states are issued by a command signer") } command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Issue() } timeWindow(TEST_TX_TIME) - this.verifies() + verifies() } } // DOCEND 7 @@ -141,7 +141,7 @@ class CommercialPaperTest { command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Issue() } attachments(CP_PROGRAM_ID) timeWindow(TEST_TX_TIME) - this.verifies() + verifies() } @@ -152,7 +152,7 @@ class CommercialPaperTest { output(CP_PROGRAM_ID, "alice's paper") { "paper".output().withOwner(ALICE) } command(ALICE_PUBKEY) { Cash.Commands.Move() } command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Move() } - this.verifies() + verifies() } } } @@ -174,7 +174,7 @@ class CommercialPaperTest { command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Issue() } attachments(CP_PROGRAM_ID) timeWindow(TEST_TX_TIME) - this.verifies() + verifies() } transaction("Trade") { @@ -184,7 +184,7 @@ class CommercialPaperTest { output(CP_PROGRAM_ID, "alice's paper") { "paper".output().withOwner(ALICE) } command(ALICE_PUBKEY) { Cash.Commands.Move() } command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Move() } - this.verifies() + verifies() } transaction { @@ -192,10 +192,10 @@ class CommercialPaperTest { // We moved a paper to another pubkey. output(CP_PROGRAM_ID, "bob's paper") { "paper".output().withOwner(BOB) } command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Move() } - this.verifies() + verifies() } - this.fails() + fails() } } // DOCEND 9 @@ -216,7 +216,7 @@ class CommercialPaperTest { command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Issue() } attachments(CP_PROGRAM_ID) timeWindow(TEST_TX_TIME) - this.verifies() + verifies() } transaction("Trade") { @@ -226,7 +226,7 @@ class CommercialPaperTest { output(CP_PROGRAM_ID, "alice's paper") { "paper".output().withOwner(ALICE) } command(ALICE_PUBKEY) { Cash.Commands.Move() } command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Move() } - this.verifies() + verifies() } tweak { @@ -235,13 +235,13 @@ class CommercialPaperTest { // We moved a paper to another pubkey. output(CP_PROGRAM_ID, "bob's paper") { "paper".output().withOwner(BOB) } command(MEGA_CORP_PUBKEY) { CommercialPaper.Commands.Move() } - this.verifies() + verifies() } - this.fails() + fails() } - this.verifies() + verifies() } } // DOCEND 10 -} \ No newline at end of file +} diff --git a/docs/source/tutorial-contract.rst b/docs/source/tutorial-contract.rst index 8c48d33358..23c1430286 100644 --- a/docs/source/tutorial-contract.rst +++ b/docs/source/tutorial-contract.rst @@ -476,7 +476,7 @@ generate methods should operate on the same transaction. You can see an example for the commercial paper contract. The paper is given to us as a ``StateAndRef`` object. This is exactly what it sounds like: -a small object that has a (copy of) a state object, and also the (txhash, index) that indicates the location of this +a small object that has a (copy of a) state object, and also the ``(txhash, index)`` that indicates the location of this state on the ledger. We add the existing paper state as an input, the same paper state with the owner field adjusted as an output, diff --git a/docs/source/tutorial-test-dsl.rst b/docs/source/tutorial-test-dsl.rst index b32be173c7..ce66251a5c 100644 --- a/docs/source/tutorial-test-dsl.rst +++ b/docs/source/tutorial-test-dsl.rst @@ -114,7 +114,7 @@ The above code however doesn't compile: Error:(35, 27) java: incompatible types: bad return type in lambda expression missing return value -This is deliberate: The DSL forces us to specify either ``this.verifies()`` or ``this `fails with` "some text"`` on the +This is deliberate: The DSL forces us to specify either ``verifies()`` or ```fails with`("some text")`` on the last line of ``transaction``: .. container:: codeset @@ -160,7 +160,7 @@ When run, that code produces the following error: net.corda.core.contracts.TransactionVerificationException$ContractRejection: java.lang.IllegalStateException: the state is propagated The transaction verification failed, because we wanted to move paper but didn't specify an output - but the state should be propagated. -However we can specify that this is an intended behaviour by changing ``this.verifies()`` to ``this `fails with` "the state is propagated"``: +However we can specify that this is an intended behaviour by changing ``verifies()`` to ```fails with`("the state is propagated")``: .. container:: codeset @@ -256,7 +256,7 @@ Now that we know how to define a single transaction, let's look at how to define :dedent: 4 In this example we declare that ``ALICE`` has $900 but we don't care where from. For this we can use -``unverifiedTransaction``. Note how we don't need to specify ``this.verifies()``. +``unverifiedTransaction``. Note how we don't need to specify ``verifies()``. Notice that we labelled output with ``"alice's $900"``, also in transaction named ``"Issuance"`` we labelled a commercial paper with ``"paper"``. Now we can subsequently refer to them in other transactions, e.g. @@ -265,7 +265,7 @@ by ``input("alice's $900")`` or ``"paper".output()``. The last transaction named ``"Trade"`` exemplifies simple fact of selling the ``CommercialPaper`` to Alice for her $900, $100 less than the face value at 10% interest after only 7 days. -We can also test whole ledger calling ``this.verifies()`` and ``this.fails()`` on the ledger level. +We can also test whole ledger calling ``verifies()`` and ``fails()`` on the ledger level. To do so let's create a simple example that uses the same input twice: .. container:: codeset @@ -283,7 +283,7 @@ To do so let's create a simple example that uses the same input twice: :dedent: 4 The transactions ``verifies()`` individually, however the state was spent twice! That's why we need the global ledger -verification (``this.fails()`` at the end). As in previous examples we can use ``tweak`` to create a local copy of the whole ledger: +verification (``fails()`` at the end). As in previous examples we can use ``tweak`` to create a local copy of the whole ledger: .. container:: codeset