Search in sources :

Example 1 with SyncProcessor

use of co.rsk.net.SyncProcessor in project rskj by rsksmart.

the class SyncNotificationEmitterTest method setUp.

@Before
public void setUp() {
    Ethereum ethereum = mock(Ethereum.class);
    serializer = mock(JsonRpcSerializer.class);
    Blockchain blockchain = mock(Blockchain.class);
    Block block = mock(Block.class);
    when(block.getNumber()).thenReturn(2L);
    when(blockchain.getBestBlock()).thenReturn(block);
    SyncProcessor syncProcessor = mock(SyncProcessor.class);
    when(syncProcessor.getInitialBlockNumber()).thenReturn(2L);
    when(syncProcessor.getHighestBlockNumber()).thenReturn(100L);
    emitter = new SyncNotificationEmitter(ethereum, serializer, blockchain, syncProcessor);
    ArgumentCaptor<EthereumListener> listenerCaptor = ArgumentCaptor.forClass(EthereumListener.class);
    verify(ethereum).addListener(listenerCaptor.capture());
    listener = listenerCaptor.getValue();
}
Also used : JsonRpcSerializer(co.rsk.rpc.JsonRpcSerializer) EthereumListener(org.ethereum.listener.EthereumListener) Ethereum(org.ethereum.facade.Ethereum) Blockchain(org.ethereum.core.Blockchain) SyncProcessor(co.rsk.net.SyncProcessor) Block(org.ethereum.core.Block) Before(org.junit.Before)

Aggregations

SyncProcessor (co.rsk.net.SyncProcessor)1 JsonRpcSerializer (co.rsk.rpc.JsonRpcSerializer)1 Block (org.ethereum.core.Block)1 Blockchain (org.ethereum.core.Blockchain)1 Ethereum (org.ethereum.facade.Ethereum)1 EthereumListener (org.ethereum.listener.EthereumListener)1 Before (org.junit.Before)1