SmartContract { public String callFuncReturningString(String function, ContractParameter... params) throws UnexpectedReturnTypeException, IOException { StackItem item = callInvokeFunction(function, Arrays.asList(params)) .getInvocationResult().getStack().get(0); if (item.getType().equals(StackItemType.BYTE_STRING)) { return item.asByteString().getAsString(); } throw new UnexpectedReturnTypeException(item.getType(), StackItemType.BYTE_STRING); } SmartContract(ScriptHash scriptHash, Neow3j neow);  SmartContract(File nef, File manifestFile, Neow3j neow);  SmartContract(NefFile nefFile, ContractManifest manifest, Neow3j neow); TransactionBuilder invokeFunction(String function,
            ContractParameter... contractParameters); String callFuncReturningString(String function, ContractParameter... params); BigInteger callFuncReturningInt(String function, ContractParameter... params); NeoInvokeFunction callInvokeFunction(String function, Signer... signers); NeoInvokeFunction callInvokeFunction(String function, List<ContractParameter> params,
            Signer... signers); ScriptHash getScriptHash(); NefFile getNefFile(); ContractManifest getManifest(); TransactionBuilder deploy();  }
@Test public void callFunctionReturningString() throws IOException { setUpWireMockForCall("invokefunction", "invokefunction_name.json", NEO_SCRIPT_HASH.toString(), NEP5_NAME); SmartContract sc = new SmartContract(NEO_SCRIPT_HASH, this.neow); String name = sc.callFuncReturningString(NEP5_NAME); assertThat(name, is("NEO")); }
@Test public void callFunctionReturningNonString() throws IOException { setUpWireMockForCall("invokefunction", "invokefunction_totalSupply.json", NEO_SCRIPT_HASH.toString(), NEP5_NAME); SmartContract sc = new SmartContract(NEO_SCRIPT_HASH, this.neow); expectedException.expect(UnexpectedReturnTypeException.class); expectedException.expectMessage(new StringContains(StackItemType.INTEGER.jsonValue())); sc.callFuncReturningString(NEP5_NAME); }