Extracted channel manager for chat room-related operations.

cefexperiments
Danny van Heumen 12 years ago
parent 3b961a9f8a
commit 580bdefb34

@ -161,7 +161,8 @@ public ChatRoomIrcImpl(final String chatRoomName,
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
this.chatRoomName =
verifyName(connection.getChannelTypes(), chatRoomName);
verifyName(connection.getChannelManager().getChannelTypes(),
chatRoomName);
this.isSystem = isSystem;
}
@ -317,13 +318,13 @@ public void join() throws OperationFailedException
OperationFailedException.NETWORK_FAILURE);
}
if (connection.isJoined(this))
if (connection.getChannelManager().isJoined(this))
{
throw new OperationFailedException("Channel is already joined.",
OperationFailedException.SUBSCRIPTION_ALREADY_EXISTS);
}
connection.join(this);
connection.getChannelManager().join(this);
}
/**
@ -339,7 +340,7 @@ public void join(final byte[] password) throws OperationFailedException
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.join(this, password.toString());
connection.getChannelManager().join(this, password.toString());
}
/**
@ -394,7 +395,7 @@ public boolean isJoined()
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
return connection.isJoined(this);
return connection.getChannelManager().isJoined(this);
}
/**
@ -408,7 +409,7 @@ public void leave()
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.leave(this);
connection.getChannelManager().leave(this);
this.chatRoomMembers.clear();
}
@ -438,7 +439,8 @@ public void banParticipant(final ChatRoomMember chatRoomMember,
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.banParticipant(this, chatRoomMember, reason);
connection.getChannelManager().banParticipant(this, chatRoomMember,
reason);
}
/**
@ -454,7 +456,8 @@ public void kickParticipant(final ChatRoomMember chatRoomMember,
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.kickParticipant(this, chatRoomMember, reason);
connection.getChannelManager().kickParticipant(this, chatRoomMember,
reason);
}
/**
@ -653,7 +656,7 @@ public void setSubject(final String subject)
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.setSubject(this, subject);
connection.getChannelManager().setSubject(this, subject);
}
catch (RuntimeException e)
{
@ -817,7 +820,7 @@ public void invite(final String userAddress, final String reason)
// some-one.
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.invite(userAddress, this);
connection.getChannelManager().invite(userAddress, this);
}
/**
@ -1343,7 +1346,7 @@ public void grantAdmin(final String address)
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.grant(this, address, Mode.OPERATOR);
connection.getChannelManager().grant(this, address, Mode.OPERATOR);
}
/**
@ -1356,7 +1359,7 @@ public void grantMembership(final String address)
// TODO currently Voice == Membership.
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.grant(this, address, Mode.VOICE);
connection.getChannelManager().grant(this, address, Mode.VOICE);
}
/**
@ -1368,7 +1371,7 @@ public void grantModerator(final String address)
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.grant(this, address, Mode.HALFOP);
connection.getChannelManager().grant(this, address, Mode.HALFOP);
}
/**
@ -1380,7 +1383,7 @@ public void grantOwnership(final String address)
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.grant(this, address, Mode.OWNER);
connection.getChannelManager().grant(this, address, Mode.OWNER);
}
/**
@ -1393,7 +1396,7 @@ public void grantVoice(final String address)
// TODO currently Voice == Membership.
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.grant(this, address, Mode.VOICE);
connection.getChannelManager().grant(this, address, Mode.VOICE);
}
/**
@ -1405,7 +1408,7 @@ public void revokeAdmin(final String address)
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.revoke(this, address, Mode.OPERATOR);
connection.getChannelManager().revoke(this, address, Mode.OPERATOR);
}
/**
@ -1420,7 +1423,7 @@ public void revokeMembership(final String address)
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.revoke(this, address, Mode.VOICE);
connection.getChannelManager().revoke(this, address, Mode.VOICE);
}
/**
@ -1433,7 +1436,7 @@ public void revokeModerator(final String address)
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.revoke(this, address, Mode.HALFOP);
connection.getChannelManager().revoke(this, address, Mode.HALFOP);
}
/**
@ -1446,7 +1449,7 @@ public void revokeOwnership(final String address)
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.revoke(this, address, Mode.OWNER);
connection.getChannelManager().revoke(this, address, Mode.OWNER);
}
/**
@ -1458,7 +1461,7 @@ public void revokeVoice(final String address)
{
final IrcConnection connection =
this.parentProvider.getIrcStack().getConnection();
connection.revoke(this, address, Mode.VOICE);
connection.getChannelManager().revoke(this, address, Mode.VOICE);
}
/**

@ -183,10 +183,8 @@ private SSLContext getCustomSSLContext(final String hostname)
SSLContext context = null;
try
{
CertificateService cs =
IrcActivator.getCertificateService();
X509TrustManager tm =
cs.getTrustManager(hostname);
CertificateService cs = IrcActivator.getCertificateService();
X509TrustManager tm = cs.getTrustManager(hostname);
context = cs.getSSLContext(tm);
}
catch (GeneralSecurityException e)

@ -364,6 +364,8 @@ public void shutdown()
public void unregister()
throws OperationFailedException
{
// TODO Consider removing the leave operations, as QUIT automatically
// leaves open channels.
for (ChatRoom joinedChatRoom : multiUserChat
.getCurrentlyJoinedChatRooms())
{

@ -16,6 +16,7 @@ public class ChatRoomIrcImplTest
private ProtocolProviderServiceIrcImpl providerMock;
private IrcStack stackMock;
private IrcConnection connectionMock;
private ChannelManager channelMock;
//@before
public void setUp() throws Exception
@ -25,23 +26,25 @@ public void setUp() throws Exception
EasyMock.createMock(ProtocolProviderServiceIrcImpl.class);
this.stackMock = EasyMock.createMock(IrcStack.class);
this.connectionMock = EasyMock.createMock(IrcConnection.class);
EasyMock.expect(this.providerMock.getIrcStack()).andReturn(stackMock);
this.channelMock = EasyMock.createMock(ChannelManager.class);
EasyMock.expect(this.providerMock.getIrcStack()).andReturn(this.stackMock);
EasyMock.expect(this.stackMock.getConnection()).andReturn(this.connectionMock);
EasyMock.expect(this.connectionMock.getChannelTypes()).andReturn(
EasyMock.expect(this.connectionMock.getChannelManager()).andReturn(this.channelMock);
EasyMock.expect(this.channelMock.getChannelTypes()).andReturn(
Collections.unmodifiableSet(Sets.newHashSet('#', '&')));
}
//@Test
public void testConstruction()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
new ChatRoomIrcImpl("#test", this.providerMock);
}
//@Test(expected = IllegalArgumentException.class)
public void testConstructionNullIdentifier()
{
EasyMock.replay(this.providerMock, this.stackMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
try
{
new ChatRoomIrcImpl(null, this.providerMock);
@ -69,7 +72,7 @@ public void testConstructionNullProvider()
//@Test(expected = IllegalArgumentException.class)
public void testEmptyName()
{
EasyMock.replay(this.providerMock, this.stackMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
try
{
new ChatRoomIrcImpl("", this.providerMock);
@ -83,7 +86,7 @@ public void testEmptyName()
//@Test(expected = IllegalArgumentException.class)
public void testTooLongName()
{
EasyMock.replay(this.providerMock, this.stackMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
try
{
new ChatRoomIrcImpl(
@ -102,7 +105,7 @@ public void testTooLongName()
//@Test
public void testAutoPrefixBadChannelName()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room = new ChatRoomIrcImpl("!test", this.providerMock);
Assert.assertEquals("#!test", room.getIdentifier());
}
@ -110,7 +113,7 @@ public void testAutoPrefixBadChannelName()
//@Test(expected = IllegalArgumentException.class)
public void testIllegalNameSpace()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
try
{
new ChatRoomIrcImpl("#test test", this.providerMock);
@ -124,7 +127,7 @@ public void testIllegalNameSpace()
//@Test(expected = IllegalArgumentException.class)
public void testIllegalNameComma()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
try
{
new ChatRoomIrcImpl("#test,test", this.providerMock);
@ -138,14 +141,14 @@ public void testIllegalNameComma()
//@Test
public void testValidName()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
}
//@Test
public void testCorrectConstruction()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
Assert.assertEquals("#my-cool-channel", room.getIdentifier());
@ -156,7 +159,7 @@ public void testCorrectConstruction()
//@Test
public void testHashCodeNotFailing()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
room.hashCode();
@ -169,12 +172,13 @@ public void testRoomIsJoined()
.andReturn(this.stackMock).times(2);
EasyMock.expect(this.stackMock.getConnection()).andReturn(
this.connectionMock).times(2);
EasyMock.expect(this.connectionMock.getChannelManager()).andReturn(this.channelMock).times(2);
EasyMock
.expect(
this.connectionMock.isJoined(EasyMock
this.channelMock.isJoined(EasyMock
.anyObject(ChatRoomIrcImpl.class))).andReturn(false)
.andReturn(true);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
Assert.assertFalse(room.isJoined());
@ -184,7 +188,7 @@ public void testRoomIsJoined()
//@Test
public void testIsPersistentRoom()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
Assert.assertTrue(room.isPersistent());
@ -193,7 +197,7 @@ public void testIsPersistentRoom()
//@Test
public void testDestroyRoom()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
Assert.assertTrue(room.destroy("whatever", null));
@ -202,7 +206,7 @@ public void testDestroyRoom()
//@Test
public void testSetLocalUserNull()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
try
@ -218,7 +222,7 @@ public void testSetLocalUserNull()
//@Test
public void testSetLocalUser()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
Assert.assertEquals(ChatRoomMemberRole.SILENT_MEMBER,
@ -243,7 +247,7 @@ public void testMemberCount()
{
ChatRoomMemberIrcImpl user =
EasyMock.createMock(ChatRoomMemberIrcImpl.class);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock,
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock,
user);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
@ -262,7 +266,7 @@ public void testAddMember()
{
ChatRoomMemberIrcImpl user =
EasyMock.createMock(ChatRoomMemberIrcImpl.class);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock,
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock,
user);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
@ -278,7 +282,7 @@ public void testRemoveMember()
{
ChatRoomMemberIrcImpl user =
EasyMock.createMock(ChatRoomMemberIrcImpl.class);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock,
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock,
user);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
@ -293,7 +297,7 @@ public void testRemoveMember()
//@Test
public void testEqualsSame()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
Assert.assertTrue(room.equals(room));
@ -302,7 +306,7 @@ public void testEqualsSame()
//@Test
public void testEqualsNull()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
Assert.assertFalse(room.equals(null));
@ -311,7 +315,7 @@ public void testEqualsNull()
//@Test
public void testEqualsOtherClassInstance()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
Assert.assertFalse(room.equals(new Object()));
@ -325,9 +329,10 @@ public void testEqualsOtherProviderInstance()
EasyMock.expect(providerMock2.getIrcStack()).andReturn(this.stackMock);
EasyMock.expect(this.stackMock.getConnection()).andReturn(
this.connectionMock);
EasyMock.expect(this.connectionMock.getChannelTypes()).andReturn(
EasyMock.expect(this.connectionMock.getChannelManager()).andReturn(this.channelMock);
EasyMock.expect(this.channelMock.getChannelTypes()).andReturn(
Collections.unmodifiableSet(Sets.newHashSet('#', '$')));
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock,
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock,
providerMock2);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
@ -342,9 +347,10 @@ public void testEqualsOtherRoomInstance()
EasyMock.expect(this.providerMock.getIrcStack()).andReturn(stackMock);
EasyMock.expect(this.stackMock.getConnection()).andReturn(
this.connectionMock);
EasyMock.expect(this.connectionMock.getChannelTypes()).andReturn(
EasyMock.expect(this.connectionMock.getChannelManager()).andReturn(this.channelMock);
EasyMock.expect(this.channelMock.getChannelTypes()).andReturn(
Collections.unmodifiableSet(Sets.newHashSet('#', '$')));
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
ChatRoomIrcImpl room2 =
@ -358,9 +364,10 @@ public void testEqualsSameRoomRepresentation()
EasyMock.expect(this.providerMock.getIrcStack()).andReturn(stackMock);
EasyMock.expect(this.stackMock.getConnection()).andReturn(
this.connectionMock);
EasyMock.expect(this.connectionMock.getChannelTypes()).andReturn(
EasyMock.expect(this.connectionMock.getChannelManager()).andReturn(this.channelMock);
EasyMock.expect(this.channelMock.getChannelTypes()).andReturn(
Collections.unmodifiableSet(Sets.newHashSet('#', '$')));
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
ChatRoomIrcImpl room2 =
@ -371,7 +378,7 @@ public void testEqualsSameRoomRepresentation()
//@Test
public void testGetChatRoomSubject()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
Assert.assertEquals("", room.getSubject());
@ -381,17 +388,19 @@ public void testGetChatRoomSubject()
public void testSetChatRoomSubject() throws OperationFailedException
{
final String newSubject = "My test subject!";
this.connectionMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.expect(this.connectionMock.getChannelManager()).andReturn(this.channelMock);
this.channelMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.eq(newSubject));
EasyMock.expectLastCall();
EasyMock.expect(this.providerMock.getIrcStack()).andReturn(
this.stackMock);
EasyMock.expect(this.stackMock.getConnection()).andReturn(
this.connectionMock);
this.connectionMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.expect(this.connectionMock.getChannelManager()).andReturn(this.channelMock);
this.channelMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.eq(newSubject));
EasyMock.expectLastCall();
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
@ -408,7 +417,8 @@ public void testSetChatRoomSubjectFailedByIndirectIOException()
throws OperationFailedException
{
final String newSubject = "My test subject!";
this.connectionMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.expect(this.connectionMock.getChannelManager()).andReturn(this.channelMock);
this.channelMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.eq(newSubject));
EasyMock.expectLastCall().andThrow(
new RuntimeException("Some error", new IOException("Real cause")));
@ -416,10 +426,11 @@ public void testSetChatRoomSubjectFailedByIndirectIOException()
this.stackMock);
EasyMock.expect(this.stackMock.getConnection()).andReturn(
this.connectionMock);
this.connectionMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.expect(this.connectionMock.getChannelManager()).andReturn(this.channelMock);
this.channelMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.eq(newSubject));
EasyMock.expectLastCall();
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
@ -440,17 +451,19 @@ public void testSetChatRoomSubjectFailedByOtherRuntimeException()
throws OperationFailedException
{
final String newSubject = "My test subject!";
this.connectionMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.expect(this.connectionMock.getChannelManager()).andReturn(this.channelMock);
this.channelMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.eq(newSubject));
EasyMock.expectLastCall().andThrow(new RuntimeException("Some error"));
EasyMock.expect(this.providerMock.getIrcStack()).andReturn(
this.stackMock);
EasyMock.expect(this.stackMock.getConnection()).andReturn(
this.connectionMock);
this.connectionMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.expect(this.connectionMock.getChannelManager()).andReturn(this.channelMock);
this.channelMock.setSubject(EasyMock.anyObject(ChatRoomIrcImpl.class),
EasyMock.eq(newSubject));
EasyMock.expectLastCall();
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl room =
new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
@ -473,7 +486,7 @@ public void testSetChatRoomSubjectFailedByOtherRuntimeException()
// @Test
public void testChatRoomWithAlternativePrefix()
{
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock);
EasyMock.replay(this.providerMock, this.stackMock, this.connectionMock, this.channelMock);
ChatRoomIrcImpl alternative =
new ChatRoomIrcImpl("&MyAlternative-channel-prefix",
this.providerMock);
@ -487,12 +500,14 @@ public void testOnlyAlternativeChannelTypesWithDefault()
EasyMock.createMock(ProtocolProviderServiceIrcImpl.class);
IrcStack specialStackMock = EasyMock.createMock(IrcStack.class);
IrcConnection specialConnectionMock = EasyMock.createMock(IrcConnection.class);
ChannelManager specialChannelMock = EasyMock.createMock(ChannelManager.class);
EasyMock.expect(specialProviderMock.getIrcStack()).andReturn(
specialStackMock);
EasyMock.expect(specialStackMock.getConnection()).andReturn(specialConnectionMock);
EasyMock.expect(specialConnectionMock.getChannelTypes()).andReturn(
EasyMock.expect(specialConnectionMock.getChannelManager()).andReturn(specialChannelMock);
EasyMock.expect(specialChannelMock.getChannelTypes()).andReturn(
Sets.newHashSet('&'));
EasyMock.replay(specialProviderMock, specialStackMock, specialConnectionMock);
EasyMock.replay(specialProviderMock, specialStackMock, specialConnectionMock, specialChannelMock);
ChatRoomIrcImpl alternative =
new ChatRoomIrcImpl("channel-name-without-prefix",
specialProviderMock);

Loading…
Cancel
Save