Changeset 531


Ignore:
Timestamp:
08/07/12 15:52:26 (12 years ago)
Author:
sherbold
Message:
Location:
trunk/quest-plugin-core-test
Files:
7 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/quest-plugin-core-test/src/test/java/de/ugoe/cs/quest/plugin/PluginLoaderTest.java

    r511 r531  
    22 
    33import java.io.File; 
     4import java.util.Collection; 
    45 
    56import junitx.framework.ArrayAssert; 
     
    155156                ArrayAssert.assertEquivalenceArrays(expected, result); 
    156157        } 
     158         
     159        @Test  
     160        public void testLoad_1() throws Exception { 
     161                PluginLoader loader = new PluginLoader(new File("testdata/de.ugoe.cs.quest.plugin.PluginLoaderTest")); 
     162                 
     163                loader.load(); 
     164                 
     165                Collection<QuestPlugin> plugins = loader.getPlugins(); 
     166                 
     167                assertEquals(1, plugins.size()); 
     168                QuestPlugin plugin = plugins.iterator().next(); 
     169                assertNotNull(plugin); 
     170                assertEquals("Mock Plugin", plugin.getTitle()); 
     171                assertArrayEquals(new String[]{"de.ugoe.cs.quest.plugin.mock.commands"}, plugin.getCommandPackages()); 
     172        } 
     173         
     174        @Test  
     175        public void testLoad_2() throws Exception { 
     176                PluginLoader loader = new PluginLoader(new File("testdata/de.ugoe.cs.quest.plugin.PluginLoaderTestInvalid_1")); 
     177                 
     178                try { 
     179                        loader.load(); 
     180                } catch(PluginLoaderException e) { 
     181                        e.getMessage().endsWith("not instance of QuestPlugin"); 
     182                } 
     183        } 
     184         
     185        @Test  
     186        public void testLoad_3() throws Exception { 
     187                PluginLoader loader = new PluginLoader(new File("testdata/de.ugoe.cs.quest.plugin.PluginLoaderTestInvalid_2")); 
     188                 
     189                try { 
     190                        loader.load(); 
     191                } catch(PluginLoaderException e) { 
     192                        e.getMessage().startsWith("No class"); 
     193                } 
     194        } 
     195         
     196        @Test  
     197        public void testLoad_4() throws Exception { 
     198                PluginLoader loader = new PluginLoader(new File("testdata/de.ugoe.cs.quest.plugin.PluginLoaderTestInvalid_3")); 
     199                 
     200                try { 
     201                        loader.load(); 
     202                } catch(PluginLoaderException e) { 
     203                        e.getMessage().endsWith("Could not access"); 
     204                } 
     205        } 
    157206 
    158207} 
Note: See TracChangeset for help on using the changeset viewer.