@Test
public void testChannelBadPeerDoesNotBelongJoin() throws Exception {

    thrown.expect(ProposalException.class);
    thrown.expectMessage("Can not add peer peer2 to channel testChannelBadPeerDoesNotBelongJoin because it already belongs to channel testChannelBadPeerDoesNotBelongJoin2");
    final Channel channel = createRunningChannel("testChannelBadPeerDoesNotBelongJoin", null);
    Collection<Peer> peers = Arrays.asList((Peer[]) new Peer[] {hfclient.newPeer("peer2", "grpc://localhost:22")});
    createRunningChannel("testChannelBadPeerDoesNotBelongJoin2", peers);
    //Peer joining channel when it belongs to another channel.
    channel.joinPeer(peers.iterator().next());
}