public void testRegisterNullCommand() { try { CommandFactory.registerCommand(null, Test.class); Assert.fail(); } catch (IllegalArgumentException e) { } }
public void testRegisterNullType() { try { CommandFactory.registerCommand("test", null); Assert.fail(); } catch (IllegalArgumentException e) { } }
public void testConstructionNullProvider() { IrcConnection connection = EasyMock.createMock(IrcConnection.class); EasyMock.replay(connection); try { new CommandFactory(null, connection); Assert.fail(); } catch (IllegalArgumentException e) { } }
public void testConstructionNullConnection() { ProtocolProviderServiceIrcImpl provider = EasyMock.createMock(ProtocolProviderServiceIrcImpl.class); EasyMock.replay(provider); try { new CommandFactory(provider, null); Assert.fail(); } catch (IllegalArgumentException e) { } }
public void testNonExistingCommand() throws BadCommandException { ProtocolProviderServiceIrcImpl provider = EasyMock.createMock(ProtocolProviderServiceIrcImpl.class); IrcConnection connection = EasyMock.createMock(IrcConnection.class); EasyMock.replay(provider, connection); try { CommandFactory factory = new CommandFactory(provider, connection); factory.createCommand("test"); Assert.fail(); } catch (UnsupportedCommandException e) { } }
public void testCreateNullCommandName() throws UnsupportedCommandException, BadCommandException { ProtocolProviderServiceIrcImpl provider = EasyMock.createMock(ProtocolProviderServiceIrcImpl.class); IrcConnection connection = EasyMock.createMock(IrcConnection.class); EasyMock.replay(provider, connection); CommandFactory.registerCommand("test", Test.class); try { CommandFactory factory = new CommandFactory(provider, connection); factory.createCommand(null); Assert.fail(); } catch (IllegalArgumentException e) { } CommandFactory.unregisterCommand(Test.class, null); }
public void testBadCommand() throws UnsupportedCommandException { ProtocolProviderServiceIrcImpl provider = EasyMock.createMock(ProtocolProviderServiceIrcImpl.class); IrcConnection connection = EasyMock.createMock(IrcConnection.class); EasyMock.replay(provider, connection); CommandFactory.registerCommand("test", BadImplementation.class); try { CommandFactory factory = new CommandFactory(provider, connection); factory.createCommand("test"); Assert.fail(); } catch (BadCommandException e) { } finally { CommandFactory.unregisterCommand(BadImplementation.class, null); } }