diff --git a/core/src/test/java/ch/dissem/bitmessage/DefaultMessageListenerTest.java b/core/src/test/java/ch/dissem/bitmessage/DefaultMessageListenerTest.java index a9bbd8c..32a20e4 100644 --- a/core/src/test/java/ch/dissem/bitmessage/DefaultMessageListenerTest.java +++ b/core/src/test/java/ch/dissem/bitmessage/DefaultMessageListenerTest.java @@ -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 diff --git a/core/src/test/java/ch/dissem/bitmessage/ProofOfWorkServiceTest.java b/core/src/test/java/ch/dissem/bitmessage/ProofOfWorkServiceTest.java index c4529e3..039e7ad 100644 --- a/core/src/test/java/ch/dissem/bitmessage/ProofOfWorkServiceTest.java +++ b/core/src/test/java/ch/dissem/bitmessage/ProofOfWorkServiceTest.java @@ -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];