use of co.rsk.test.builders.AccountBuilder in project rskj by rsksmart.
the class AddressesTopicsFilterTest method matchAddress.
@Test
public void matchAddress() {
Account account = new AccountBuilder().name("account").build();
RskAddress address = account.getAddress();
AddressesTopicsFilter filter = new AddressesTopicsFilter(new RskAddress[] { address }, null);
Assert.assertTrue(filter.matchesContractAddress(address));
Assert.assertFalse(filter.matchesContractAddress(RskAddress.nullAddress()));
}
use of co.rsk.test.builders.AccountBuilder in project rskj by rsksmart.
the class AddressesTopicsFilterTest method matchAllBloomWithFilterWithAccount.
@Test
public void matchAllBloomWithFilterWithAccount() {
Account account = new AccountBuilder().name("account").build();
RskAddress address = account.getAddress();
AddressesTopicsFilter filter = new AddressesTopicsFilter(new RskAddress[] { address }, null);
Assert.assertTrue(filter.matchBloom(getAllBloom()));
}
use of co.rsk.test.builders.AccountBuilder in project rskj by rsksmart.
the class AddressesTopicsFilterTest method noMatchEmptyBloomWithFilterWithAccount.
@Test
public void noMatchEmptyBloomWithFilterWithAccount() {
Account account = new AccountBuilder().name("account").build();
RskAddress address = account.getAddress();
AddressesTopicsFilter filter = new AddressesTopicsFilter(new RskAddress[] { address }, null);
Assert.assertFalse(filter.matchBloom(new Bloom()));
}
use of co.rsk.test.builders.AccountBuilder in project rskj by rsksmart.
the class PendingTransactionFilterTest method twoTransactionsAndEvents.
@Test
public void twoTransactionsAndEvents() {
PendingTransactionFilter filter = new PendingTransactionFilter();
Account sender = new AccountBuilder().name("sender").build();
Account receiver = new AccountBuilder().name("receiver").build();
Transaction tx1 = new TransactionBuilder().sender(sender).receiver(receiver).value(BigInteger.TEN).build();
Transaction tx2 = new TransactionBuilder().sender(sender).receiver(receiver).value(BigInteger.ONE).build();
filter.newPendingTx(tx1);
filter.newPendingTx(tx2);
Object[] result = filter.getEvents();
Assert.assertNotNull(result);
Assert.assertEquals(2, result.length);
Assert.assertEquals("0x" + tx1.getHash().toHexString(), result[0]);
Assert.assertEquals("0x" + tx2.getHash().toHexString(), result[1]);
}
use of co.rsk.test.builders.AccountBuilder in project rskj by rsksmart.
the class PendingTransactionFilterTest method oneTransactionAndEvents.
@Test
public void oneTransactionAndEvents() {
PendingTransactionFilter filter = new PendingTransactionFilter();
Account sender = new AccountBuilder().name("sender").build();
Account receiver = new AccountBuilder().name("receiver").build();
Transaction tx = new TransactionBuilder().sender(sender).receiver(receiver).value(BigInteger.TEN).build();
filter.newPendingTx(tx);
Object[] result = filter.getEvents();
Assert.assertNotNull(result);
Assert.assertEquals(1, result.length);
Assert.assertEquals("0x" + tx.getHash().toHexString(), result[0]);
}
Aggregations