Package org.bukkit.plugin

Examples of org.bukkit.plugin.TestPlugin


        return new StandardMessenger();
    }

    private int count = 0;
    public TestPlugin getPlugin() {
        return new TestPlugin("" + count++);
    }
View Full Code Here


    }

    @Test
    public void testRegisterAndUnregisterOutgoingPluginChannel() {
        Messenger messenger = getMessenger();
        TestPlugin plugin = getPlugin();

        assertFalse(messenger.isOutgoingChannelRegistered(plugin, "foo"));
        messenger.registerOutgoingPluginChannel(plugin, "foo");
        assertTrue(messenger.isOutgoingChannelRegistered(plugin, "foo"));
        assertFalse(messenger.isOutgoingChannelRegistered(plugin, "bar"));
View Full Code Here

    }

    @Test(expected = ReservedChannelException.class)
    public void testReservedOutgoingRegistration() {
        Messenger messenger = getMessenger();
        TestPlugin plugin = getPlugin();

        messenger.registerOutgoingPluginChannel(plugin, "REGISTER");
    }
View Full Code Here

    }

    @Test
    public void testUnregisterOutgoingPluginChannel_Plugin() {
        Messenger messenger = getMessenger();
        TestPlugin plugin = getPlugin();

        assertFalse(messenger.isOutgoingChannelRegistered(plugin, "foo"));
        messenger.registerOutgoingPluginChannel(plugin, "foo");
        messenger.registerOutgoingPluginChannel(plugin, "bar");
        assertTrue(messenger.isOutgoingChannelRegistered(plugin, "foo"));
View Full Code Here

    }

    @Test
    public void testRegisterIncomingPluginChannel() {
        Messenger messenger = getMessenger();
        TestPlugin plugin = getPlugin();
        TestMessageListener listener = new TestMessageListener("foo", "bar".getBytes());
        Player player = TestPlayer.getInstance();
        PluginMessageListenerRegistration registration = messenger.registerIncomingPluginChannel(plugin, "foo", listener);

        assertTrue(registration.isValid());
View Full Code Here

    }

    @Test(expected = ReservedChannelException.class)
    public void testReservedIncomingRegistration() {
        Messenger messenger = getMessenger();
        TestPlugin plugin = getPlugin();

        messenger.registerIncomingPluginChannel(plugin, "REGISTER", new TestMessageListener("foo", "bar".getBytes()));
    }
View Full Code Here

    }

    @Test(expected = IllegalArgumentException.class)
    public void testDuplicateIncomingRegistration() {
        Messenger messenger = getMessenger();
        TestPlugin plugin = getPlugin();
        TestMessageListener listener = new TestMessageListener("foo", "bar".getBytes());

        messenger.registerIncomingPluginChannel(plugin, "baz", listener);
        messenger.registerIncomingPluginChannel(plugin, "baz", listener);
    }
View Full Code Here

    }

    @Test
    public void testUnregisterIncomingPluginChannel_Plugin_String() {
        Messenger messenger = getMessenger();
        TestPlugin plugin = getPlugin();
        TestMessageListener listener1 = new TestMessageListener("foo", "bar".getBytes());
        TestMessageListener listener2 = new TestMessageListener("baz", "qux".getBytes());
        Player player = TestPlayer.getInstance();
        PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin, "foo", listener1);
        PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin, "baz", listener2);
View Full Code Here

    }

    @Test
    public void testUnregisterIncomingPluginChannel_Plugin() {
        Messenger messenger = getMessenger();
        TestPlugin plugin = getPlugin();
        TestMessageListener listener1 = new TestMessageListener("foo", "bar".getBytes());
        TestMessageListener listener2 = new TestMessageListener("baz", "qux".getBytes());
        Player player = TestPlayer.getInstance();
        PluginMessageListenerRegistration registration1 = messenger.registerIncomingPluginChannel(plugin, "foo", listener1);
        PluginMessageListenerRegistration registration2 = messenger.registerIncomingPluginChannel(plugin, "baz", listener2);
View Full Code Here

    }

    @Test
    public void testGetOutgoingChannels() {
        Messenger messenger = getMessenger();
        TestPlugin plugin1 = getPlugin();
        TestPlugin plugin2 = getPlugin();

        assertEquals(messenger.getOutgoingChannels());

        messenger.registerOutgoingPluginChannel(plugin1, "foo");
        messenger.registerOutgoingPluginChannel(plugin1, "bar");
View Full Code Here

TOP

Related Classes of org.bukkit.plugin.TestPlugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.