@@ -39,15 +39,14 @@ public class ContractRouterTest {
3939 public void testCreateFailsWithoutValidOptions () {
4040 thrown .expect (IllegalArgumentException .class );
4141 thrown .expectMessage (containsString (
42- "The chaincode id must be specified using either the -i or --i command line options or the CORE_CHAINCODE_ID_NAME environment variable." ));
42+ "The chaincode id must be specified using either the -i or --i command line options or the CORE_CHAINCODE_ID_NAME environment variable." ));
4343
44- @ SuppressWarnings ("unused" )
45- final ContractRouter r = new ContractRouter (new String [] {});
44+ @ SuppressWarnings ("unused" ) final ContractRouter r = new ContractRouter (new String []{});
4645 }
4746
4847 @ Test
4948 public void testCreateAndScan () {
50- final ContractRouter r = new ContractRouter (new String [] {"-a" , "127.0.0.1:7052" , "-i" , "testId" });
49+ final ContractRouter r = new ContractRouter (new String []{"-a" , "127.0.0.1:7052" , "-i" , "testId" });
5150 r .findAllContracts ();
5251 final ChaincodeStub s = new ChaincodeStubNaiveImpl ();
5352
@@ -65,7 +64,7 @@ public void testCreateAndScan() {
6564
6665 @ Test
6766 public void testInit () {
68- final ContractRouter r = new ContractRouter (new String [] {"-a" , "127.0.0.1:7052" , "-i" , "testId" });
67+ final ContractRouter r = new ContractRouter (new String []{"-a" , "127.0.0.1:7052" , "-i" , "testId" });
6968 r .findAllContracts ();
7069 final ChaincodeStub s = new ChaincodeStubNaiveImpl ();
7170
@@ -96,7 +95,7 @@ public void testInit() {
9695 */
9796 @ Test
9897 public void testInvokeTwoTxnsThatExist () {
99- final ContractRouter r = new ContractRouter (new String [] {"-a" , "127.0.0.1:7052" , "-i" , "testId" });
98+ final ContractRouter r = new ContractRouter (new String []{"-a" , "127.0.0.1:7052" , "-i" , "testId" });
10099 r .findAllContracts ();
101100 final ChaincodeStub s = new ChaincodeStubNaiveImpl ();
102101
@@ -143,7 +142,7 @@ public void testInvokeTwoTxnsThatExist() {
143142
144143 @ Test
145144 public void testInvokeTxnWithDefinedName () {
146- final ContractRouter r = new ContractRouter (new String [] {"-a" , "127.0.0.1:7052" , "-i" , "testId" });
145+ final ContractRouter r = new ContractRouter (new String []{"-a" , "127.0.0.1:7052" , "-i" , "testId" });
147146 r .findAllContracts ();
148147 final ChaincodeStub s = new ChaincodeStubNaiveImpl ();
149148
@@ -173,7 +172,7 @@ public void testInvokeTxnWithDefinedName() {
173172 */
174173 @ Test
175174 public void testInvokeTwoTxnsWithDefaultNamespace () {
176- final ContractRouter r = new ContractRouter (new String [] {"-a" , "127.0.0.1:7052" , "-i" , "testId" });
175+ final ContractRouter r = new ContractRouter (new String []{"-a" , "127.0.0.1:7052" , "-i" , "testId" });
177176 r .findAllContracts ();
178177 final ChaincodeStub s = new ChaincodeStubNaiveImpl ();
179178
@@ -220,7 +219,7 @@ public void testInvokeTwoTxnsWithDefaultNamespace() {
220219
221220 @ Test
222221 public void testInvokeTxnWithDefinedNameUsingMethodName () {
223- final ContractRouter r = new ContractRouter (new String [] {"-a" , "127.0.0.1:7052" , "-i" , "testId" });
222+ final ContractRouter r = new ContractRouter (new String []{"-a" , "127.0.0.1:7052" , "-i" , "testId" });
224223 r .findAllContracts ();
225224 final ChaincodeStub s = new ChaincodeStubNaiveImpl ();
226225
@@ -247,7 +246,7 @@ public void testInvokeTxnWithDefinedNameUsingMethodName() {
247246
248247 @ Test
249248 public void testInvokeContractThatDoesNotExist () {
250- final ContractRouter r = new ContractRouter (new String [] {"-a" , "127.0.0.1:7052" , "-i" , "testId" });
249+ final ContractRouter r = new ContractRouter (new String []{"-a" , "127.0.0.1:7052" , "-i" , "testId" });
251250 r .findAllContracts ();
252251 final ChaincodeStub s = new ChaincodeStubNaiveImpl ();
253252
@@ -274,7 +273,7 @@ public void testInvokeContractThatDoesNotExist() {
274273
275274 @ Test
276275 public void testInvokeTxnThatDoesNotExist () {
277- final ContractRouter r = new ContractRouter (new String [] {"-a" , "127.0.0.1:7052" , "-i" , "testId" });
276+ final ContractRouter r = new ContractRouter (new String []{"-a" , "127.0.0.1:7052" , "-i" , "testId" });
278277 r .findAllContracts ();
279278 final ChaincodeStub s = new ChaincodeStubNaiveImpl ();
280279
@@ -301,7 +300,7 @@ public void testInvokeTxnThatDoesNotExist() {
301300
302301 @ Test
303302 public void testInvokeTxnThatReturnsNullString () {
304- final ContractRouter r = new ContractRouter (new String [] {"-a" , "127.0.0.1:7052" , "-i" , "testId" });
303+ final ContractRouter r = new ContractRouter (new String []{"-a" , "127.0.0.1:7052" , "-i" , "testId" });
305304 r .findAllContracts ();
306305 final ChaincodeStub s = new ChaincodeStubNaiveImpl ();
307306
@@ -328,7 +327,7 @@ public void testInvokeTxnThatReturnsNullString() {
328327
329328 @ Test
330329 public void testInvokeTxnThatThrowsAnException () {
331- final ContractRouter r = new ContractRouter (new String [] {"-a" , "127.0.0.1:7052" , "-i" , "testId" });
330+ final ContractRouter r = new ContractRouter (new String []{"-a" , "127.0.0.1:7052" , "-i" , "testId" });
332331 r .findAllContracts ();
333332 final ChaincodeStub s = new ChaincodeStubNaiveImpl ();
334333
@@ -355,7 +354,7 @@ public void testInvokeTxnThatThrowsAnException() {
355354
356355 @ Test
357356 public void testInvokeTxnThatThrowsAChaincodeException () {
358- final ContractRouter r = new ContractRouter (new String [] {"-a" , "127.0.0.1:7052" , "-i" , "testId" });
357+ final ContractRouter r = new ContractRouter (new String []{"-a" , "127.0.0.1:7052" , "-i" , "testId" });
359358 r .findAllContracts ();
360359 final ChaincodeStub s = new ChaincodeStubNaiveImpl ();
361360
@@ -393,7 +392,7 @@ public void createContractRuntimeExceptions() {
393392 @ Test
394393 public void testStartingContractRouterWithStartingAChaincodeServer () throws IOException {
395394 ChaincodeServerProperties chaincodeServerProperties = new ChaincodeServerProperties ();
396- final ContractRouter r = new ContractRouter (new String [] {"-i" , "testId" });
395+ final ContractRouter r = new ContractRouter (new String []{"-i" , "testId" });
397396 ChaincodeServer chaincodeServer = new NettyChaincodeServer (r , chaincodeServerProperties );
398397
399398 new Thread (() -> {
@@ -425,7 +424,8 @@ public void testStartingContractRouterWithStartingAChaincodeServer() throws IOEx
425424
426425 final Chaincode .Response response = r .init (s );
427426 assertThat (response , is (notNullValue ()));
428- assertThat (response .getStatus (), is (Chaincode .Response .Status .SUCCESS ));
427+ assertThat (response .getMessage () + " " + response .getStringPayload () + response .toString (),
428+ response .getStatus (), is (Chaincode .Response .Status .SUCCESS ));
429429 assertThat (response .getMessage (), is (nullValue ()));
430430 assertThat (response .getStringPayload (), is (equalTo ("asdf" )));
431431 assertThat (SampleContract .getBeforeInvoked (), is (1 ));
0 commit comments