use of org.ethereum.vm.program.ProgramResult in project rskj by rsksmart.
the class EthModuleTest method callSmokeTest.
@Test
public void callSmokeTest() {
Web3.CallArguments args = new Web3.CallArguments();
Block executionBlock = mock(Block.class);
ExecutionBlockRetriever retriever = mock(ExecutionBlockRetriever.class);
when(retriever.getExecutionBlock("latest")).thenReturn(executionBlock);
byte[] hreturn = TypeConverter.stringToByteArray("hello");
ProgramResult executorResult = mock(ProgramResult.class);
when(executorResult.getHReturn()).thenReturn(hreturn);
ReversibleTransactionExecutor executor = mock(ReversibleTransactionExecutor.class);
when(executor.executeTransaction(eq(executionBlock), any(), any(), any(), any(), any(), any(), any())).thenReturn(executorResult);
EthModule eth = new EthModule(null, null, executor, retriever, null, null);
String result = eth.call(args, "latest");
assertThat(result, is(TypeConverter.toJsonHex(hreturn)));
}
use of org.ethereum.vm.program.ProgramResult in project rskj by rsksmart.
the class ProgramTest method helloContractIsNotPayable.
@Test
public void helloContractIsNotPayable() {
ProgramResult result = TestContract.hello().executeFunction("hello", BigInteger.TEN);
Assert.assertTrue(result.isRevert());
Assert.assertNull(result.getException());
}
use of org.ethereum.vm.program.ProgramResult in project rskj by rsksmart.
the class ProgramTest method cantCreateTooLargeContract.
@Test
public void cantCreateTooLargeContract() {
ProgramResult result = TestContract.bigTest().createContract();
Assert.assertFalse(result.isRevert());
Assert.assertNotNull(result.getException());
Assert.assertTrue(result.getException() instanceof RuntimeException);
}
Aggregations