Skip to content

Commit 2b15a9d

Browse files
authored
Merge pull request corda#4 from xavierlepretre/master
Fixed different lender and borrower test.
2 parents 03fe800 + d9f6c55 commit 2b15a9d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Basic/cordapp-example/contracts-java/src/main/java/com/example/contract/IOUContract.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void verify(LedgerTransaction tx) {
4242
tx.getOutputs().size() == 1);
4343
final IOUState out = tx.outputsOfType(IOUState.class).get(0);
4444
require.using("The lender and the borrower cannot be the same entity.",
45-
out.getLender() != out.getBorrower());
45+
!out.getLender().equals(out.getBorrower()));
4646
require.using("All of the participants must be signers.",
4747
command.getSigners().containsAll(out.getParticipants().stream().map(AbstractParty::getOwningKey).collect(Collectors.toList())));
4848

Basic/cordapp-example/workflows-java/src/test/java/com/example/test/contract/IOUContractTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
import net.corda.testing.node.MockServices;
1010
import org.junit.Test;
1111

12-
import static java.util.Arrays.*;
13-
12+
import static java.util.Arrays.asList;
1413
import static net.corda.testing.node.NodeTestUtils.ledger;
1514

1615
public class IOUContractTests {
@@ -89,9 +88,10 @@ public void borrowerMustSignTransaction() {
8988

9089
@Test
9190
public void lenderIsNotBorrower() {
91+
final TestIdentity megaCorpDupe = new TestIdentity(megaCorp.getName(), megaCorp.getKeyPair());
9292
ledger(ledgerServices, (ledger -> {
9393
ledger.transaction(tx -> {
94-
tx.output(IOUContract.ID, new IOUState(iouValue, megaCorp.getParty(), megaCorp.getParty(), new UniqueIdentifier()));
94+
tx.output(IOUContract.ID, new IOUState(iouValue, megaCorp.getParty(), megaCorpDupe.getParty(), new UniqueIdentifier()));
9595
tx.command(ImmutableList.of(megaCorp.getPublicKey(), miniCorp.getPublicKey()), new IOUContract.Commands.Create());
9696
tx.failsWith("The lender and the borrower cannot be the same entity.");
9797
return null;

0 commit comments

Comments
 (0)