Fixed tests

This commit is contained in:
Christian Basler 2016-09-12 10:02:52 +02:00
parent 489b8968e0
commit 71124d7b01
2 changed files with 6 additions and 3 deletions

View File

@ -69,6 +69,8 @@ public class DefaultMessageListenerTest extends TestBase {
when(ctx.getLabeler()).thenReturn(mock(Labeler.class));
listener = new DefaultMessageListener(mock(Labeler.class), mock(BitmessageContext.Listener.class));
when(ctx.getNetworkListener()).thenReturn(listener);
listener.setContext(ctx);
}
@Test

View File

@ -66,6 +66,7 @@ public class ProofOfWorkServiceTest {
when(ctx.getNetworkHandler()).thenReturn(networkHandler);
when(ctx.getMessageRepository()).thenReturn(messageRepo);
when(ctx.getLabeler()).thenReturn(mock(Labeler.class));
when(ctx.getNetworkListener()).thenReturn(mock(NetworkHandler.MessageListener.class));
proofOfWorkService = new ProofOfWorkService();
proofOfWorkService.setContext(ctx);
@ -80,7 +81,7 @@ public class ProofOfWorkServiceTest {
proofOfWorkService.doMissingProofOfWork(10);
verify(cryptography, timeout(1000)).doProofOfWork((ObjectMessage) isNull(), eq(1001L), eq(1002L),
any(ProofOfWorkEngine.Callback.class));
any(ProofOfWorkEngine.Callback.class));
}
@Test
@ -89,8 +90,8 @@ public class ProofOfWorkServiceTest {
BitmessageAddress address = TestUtils.loadContact();
Plaintext plaintext = new Plaintext.Builder(MSG).from(identity).to(address).message("", "").build();
ObjectMessage object = new ObjectMessage.Builder()
.payload(new Msg(plaintext))
.build();
.payload(new Msg(plaintext))
.build();
object.sign(identity.getPrivateKey());
object.encrypt(address.getPubkey());
byte[] initialHash = new byte[64];