Some code for supporting chans

This commit is contained in:
2016-03-31 20:04:23 +02:00
parent 3e5e431d6f
commit ead5341b2e
6 changed files with 115 additions and 17 deletions

View File

@@ -39,7 +39,7 @@ import static ch.dissem.bitmessage.entity.payload.ObjectType.*;
import static ch.dissem.bitmessage.utils.MessageMatchers.object;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.*;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.*;
@@ -206,4 +206,21 @@ public class BitmessageContextTest {
.build();
ctx.send(msg);
}
@Test
public void ensureChanIsJoined() {
String chanAddress = "BM-2cW67GEKkHGonXKZLCzouLLxnLym3azS8r";
BitmessageAddress chan = ctx.joinChan("general", chanAddress);
assertNotNull(chan);
assertEquals(chan.getAddress(), chanAddress);
assertTrue(chan.isChan());
}
@Test
public void ensureChanIsCreated() {
BitmessageAddress chan = ctx.createChan("test");
assertNotNull(chan);
assertEquals(chan.getVersion(), Pubkey.LATEST_VERSION);
assertTrue(chan.isChan());
}
}

View File

@@ -20,7 +20,10 @@ import ch.dissem.bitmessage.entity.payload.Pubkey;
import ch.dissem.bitmessage.entity.payload.V4Pubkey;
import ch.dissem.bitmessage.entity.valueobject.PrivateKey;
import ch.dissem.bitmessage.exception.DecryptionFailedException;
import ch.dissem.bitmessage.utils.*;
import ch.dissem.bitmessage.utils.Base58;
import ch.dissem.bitmessage.utils.Bytes;
import ch.dissem.bitmessage.utils.Strings;
import ch.dissem.bitmessage.utils.TestUtils;
import org.junit.Test;
import java.io.IOException;