use of org.ethereum.rpc.LogFilterElement in project rskj by rsksmart.
the class Web3RskImplTest method web3_LogFilterElement_toString.
@Test
public void web3_LogFilterElement_toString() {
LogInfo logInfo = Mockito.mock(LogInfo.class);
byte[] valueToTest = HashUtil.keccak256(new byte[] { 1 });
Mockito.when(logInfo.getData()).thenReturn(valueToTest);
List<DataWord> topics = new ArrayList<>();
topics.add(new DataWord("c1"));
topics.add(new DataWord("c2"));
Mockito.when(logInfo.getTopics()).thenReturn(topics);
Block block = Mockito.mock(Block.class);
Mockito.when(block.getHash()).thenReturn(new Keccak256(valueToTest));
Mockito.when(block.getNumber()).thenReturn(1L);
int txIndex = 1;
Transaction tx = Mockito.mock(Transaction.class);
byte[] bytes = new byte[32];
bytes[0] = 2;
Mockito.when(tx.getHash()).thenReturn(new Keccak256(bytes));
int logIdx = 5;
LogFilterElement logFilterElement = new LogFilterElement(logInfo, block, txIndex, tx, logIdx);
Assert.assertEquals(logFilterElement.toString(), "LogFilterElement{logIndex='0x5', blockNumber='0x1', blockHash='0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2', transactionHash='0x0200000000000000000000000000000000000000000000000000000000000000', transactionIndex='0x1', address='0x00', data='0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2', topics=[0x00000000000000000000000000000000000000000000000000000000000000c1, 0x00000000000000000000000000000000000000000000000000000000000000c2]}");
}
use of org.ethereum.rpc.LogFilterElement in project rskj by rsksmart.
the class Web3RskImplTest method web3_LogFilterElementNullData_toString.
@Test
public void web3_LogFilterElementNullData_toString() {
LogInfo logInfo = mock(LogInfo.class);
byte[] valueToTest = HashUtil.keccak256(new byte[] { 1 });
Mockito.when(logInfo.getData()).thenReturn(null);
List<DataWord> topics = new ArrayList<>();
topics.add(DataWord.valueFromHex("c1"));
topics.add(DataWord.valueFromHex("c2"));
Mockito.when(logInfo.getTopics()).thenReturn(topics);
Block block = mock(Block.class);
Mockito.when(block.getHash()).thenReturn(new Keccak256(valueToTest));
Mockito.when(block.getNumber()).thenReturn(1L);
int txIndex = 1;
Transaction tx = mock(Transaction.class);
byte[] bytes = new byte[32];
bytes[0] = 2;
Mockito.when(tx.getHash()).thenReturn(new Keccak256(bytes));
int logIdx = 5;
LogFilterElement logFilterElement = new LogFilterElement(logInfo, block, txIndex, tx, logIdx);
assertEquals("LogFilterElement{logIndex='0x5', blockNumber='0x1', blockHash='0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2', transactionHash='0x0200000000000000000000000000000000000000000000000000000000000000', transactionIndex='0x1', address='0x', data='0x', topics=[0x00000000000000000000000000000000000000000000000000000000000000c1, 0x00000000000000000000000000000000000000000000000000000000000000c2]}", logFilterElement.toString());
}
use of org.ethereum.rpc.LogFilterElement in project rskj by rsksmart.
the class Web3RskImplTest method web3_LogFilterElementNullAddress_toString.
@Test
public void web3_LogFilterElementNullAddress_toString() {
LogInfo logInfo = mock(LogInfo.class);
byte[] valueToTest = HashUtil.keccak256(new byte[] { 1 });
Mockito.when(logInfo.getData()).thenReturn(valueToTest);
List<DataWord> topics = new ArrayList<>();
topics.add(DataWord.valueFromHex("c1"));
topics.add(DataWord.valueFromHex("c2"));
Mockito.when(logInfo.getTopics()).thenReturn(topics);
Block block = mock(Block.class);
Mockito.when(block.getHash()).thenReturn(new Keccak256(valueToTest));
Mockito.when(block.getNumber()).thenReturn(1L);
int txIndex = 1;
Transaction tx = mock(Transaction.class);
byte[] bytes = new byte[32];
bytes[0] = 2;
Mockito.when(tx.getHash()).thenReturn(new Keccak256(bytes));
int logIdx = 5;
LogFilterElement logFilterElement = new LogFilterElement(logInfo, block, txIndex, tx, logIdx);
assertEquals("LogFilterElement{logIndex='0x5', blockNumber='0x1', blockHash='0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2', transactionHash='0x0200000000000000000000000000000000000000000000000000000000000000', transactionIndex='0x1', address='0x', data='0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2', topics=[0x00000000000000000000000000000000000000000000000000000000000000c1, 0x00000000000000000000000000000000000000000000000000000000000000c2]}", logFilterElement.toString());
}
Aggregations