Fix java fabcar queryAllCars (#239)

Java chaincode still does not support open ended range queries

Signed-off-by: James Taylor <jamest@uk.ibm.com>
This commit is contained in:
James Taylor 2020-07-09 17:32:08 +01:00 committed by GitHub
parent df727853c8
commit 5fe1387a89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -143,8 +143,8 @@ public final class FabCar implements ContractInterface {
public String queryAllCars(final Context ctx) {
ChaincodeStub stub = ctx.getStub();
final String startKey = "";
final String endKey = "";
final String startKey = "CAR1";
final String endKey = "CAR99";
List<CarQueryResult> queryResults = new ArrayList<CarQueryResult>();
QueryResultsIterator<KeyValue> results = stub.getStateByRange(startKey, endKey);

View file

@ -211,7 +211,7 @@ public final class FabCarTest {
Context ctx = mock(Context.class);
ChaincodeStub stub = mock(ChaincodeStub.class);
when(ctx.getStub()).thenReturn(stub);
when(stub.getStateByRange("", "")).thenReturn(new MockCarResultsIterator());
when(stub.getStateByRange("CAR1", "CAR99")).thenReturn(new MockCarResultsIterator());
String cars = contract.queryAllCars(ctx);