Move the CommercialPaperTest examples to a location where it'll be run by gradle/ci. Make sure the tests pass, even the example tests that are intended to fail, so these files are kept up to date as the code changes.

This commit is contained in:
Mike Hearn
2018-01-09 17:46:57 +01:00
parent 5e7d2f00ae
commit 094e96d303
3 changed files with 30 additions and 24 deletions

View File

@ -2,6 +2,7 @@ package net.corda.docs.java.tutorial.testdsl;
import kotlin.Unit;
import net.corda.core.contracts.PartyAndReference;
import net.corda.core.contracts.TransactionVerificationException;
import net.corda.core.identity.CordaX500Name;
import net.corda.finance.contracts.ICommercialPaperState;
import net.corda.finance.contracts.JavaCommercialPaper;
@ -43,7 +44,8 @@ public class CommercialPaperTest {
// DOCEND 1
// DOCSTART 2
@Test
// This example test will fail with this exception.
@Test(expected = IllegalStateException.class)
public void simpleCP() {
ICommercialPaperState inState = getPaper();
ledger(ledgerServices, l -> {
@ -58,7 +60,8 @@ public class CommercialPaperTest {
// DOCEND 2
// DOCSTART 3
@Test
// This example test will fail with this exception.
@Test(expected = TransactionVerificationException.ContractRejection.class)
public void simpleCPMove() {
ICommercialPaperState inState = getPaper();
ledger(ledgerServices, l -> {

View File

@ -2,6 +2,7 @@ package net.corda.docs.tutorial.testdsl
import com.nhaarman.mockito_kotlin.doReturn
import com.nhaarman.mockito_kotlin.whenever
import net.corda.core.contracts.TransactionVerificationException
import net.corda.core.crypto.generateKeyPair
import net.corda.core.identity.CordaX500Name
import net.corda.core.utilities.days
@ -53,7 +54,8 @@ class CommercialPaperTest {
// DOCEND 1
// DOCSTART 2
@Test
// This example test will fail with this exception.
@Test(expected = IllegalStateException::class)
fun simpleCP() {
val inState = getPaper()
ledgerServices.ledger(DUMMY_NOTARY) {
@ -67,7 +69,8 @@ class CommercialPaperTest {
// DOCEND 2
// DOCSTART 3
@Test
// This example test will fail with this exception.
@Test(expected = TransactionVerificationException.ContractRejection::class)
fun simpleCPMove() {
val inState = getPaper()
ledgerServices.ledger(DUMMY_NOTARY) {