Provide a more flexible way to label messages.
I'm not quite sure about chans yet
This commit is contained in:
@ -143,10 +143,11 @@ public class BitmessageContextTest {
|
||||
objects.add(TestUtils.loadObjectMessage(5, "V5Broadcast.payload"));
|
||||
when(ctx.internals().getInventory().getObjects(eq(address.getStream()), anyLong(), any(ObjectType.class)))
|
||||
.thenReturn(objects);
|
||||
when(ctx.addresses().getSubscriptions(anyLong())).thenReturn(Collections.singletonList(address));
|
||||
|
||||
ctx.addSubscribtion(address);
|
||||
|
||||
verify(ctx.addresses(), times(1)).save(address);
|
||||
verify(ctx.addresses(), atLeastOnce()).save(address);
|
||||
assertThat(address.isSubscribed(), is(true));
|
||||
verify(ctx.internals().getInventory()).getObjects(eq(address.getStream()), anyLong(), any(ObjectType.class));
|
||||
verify(listener).receive(any(Plaintext.class));
|
||||
@ -232,6 +233,7 @@ public class BitmessageContextTest {
|
||||
expected.remove(a.getAddress());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ensureShortDeterministicAddressesAreCreated() {
|
||||
final int expected_size = 1;
|
||||
|
@ -25,6 +25,7 @@ import ch.dissem.bitmessage.entity.payload.GetPubkey;
|
||||
import ch.dissem.bitmessage.entity.payload.Msg;
|
||||
import ch.dissem.bitmessage.factory.Factory;
|
||||
import ch.dissem.bitmessage.ports.AddressRepository;
|
||||
import ch.dissem.bitmessage.ports.Labeler;
|
||||
import ch.dissem.bitmessage.ports.MessageRepository;
|
||||
import ch.dissem.bitmessage.utils.Singleton;
|
||||
import ch.dissem.bitmessage.utils.TestBase;
|
||||
@ -62,7 +63,7 @@ public class DefaultMessageListenerTest extends TestBase {
|
||||
when(ctx.getAddressRepository()).thenReturn(addressRepo);
|
||||
when(ctx.getMessageRepository()).thenReturn(messageRepo);
|
||||
|
||||
listener = new DefaultMessageListener(ctx, mock(BitmessageContext.Listener.class));
|
||||
listener = new DefaultMessageListener(ctx, mock(Labeler.class), mock(BitmessageContext.Listener.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user