001    package nl.cwi.sen1.visplugin;
002    
003    
004    import aterm.pure.PureFactory;
005    import junit.framework.TestCase;
006    
007    public class TestVisualizationPluginController extends TestCase {
008    
009        private ExampleVisualizationController m_pluginController;
010        private PureFactory m_pureFactory;
011    
012    
013        /**
014         * Sets up the test fixture.
015         * (Called before every test case method.)
016         */
017        protected void setUp() {
018            m_pluginController = new ExampleVisualizationController();
019    
020            m_pureFactory = VisualizationFactorySingleton.getPureFactoryInstance();
021            m_pluginController.initPluginController(m_pureFactory);
022        }
023    
024        /**
025         * Tears down the test fixture.
026         * (Called after every test case method.)
027         */
028        protected void tearDown() {
029    
030        }
031    
032        /**
033         * Test if the constructor call is done properly
034         * @author Aldert Boerhoop
035         * @date 21-2-2007
036         */
037        public void test_PluginControllerClass() {
038            assertNotNull(m_pluginController);
039        }
040    
041        /**
042         * Test if vpGetName works
043         * @author Aldert Boerhoop
044         * @date 21-2-2007
045         */
046        public void test_vpGetName() {
047              assertEquals(m_pluginController.vpGetName(),m_pureFactory.make("snd-value(vp-name(<str>))","Visualisatie Test Plugin"));
048        }
049    
050        /**
051         * Test if vpIsTypeSupported works
052         * @author Aldert Boerhoop
053         * @date 21-2-2007
054         */
055        public void test_vpIsTypeSupported() {
056            assertEquals(m_pluginController.vpIsTypeSupported(m_pureFactory.make("relation([str,str])")),m_pureFactory.make("snd-value(vp-type-supported(<bool>))",true));
057            assertEquals(m_pluginController.vpIsTypeSupported(m_pureFactory.make("relation([int,str])")),m_pureFactory.make("snd-value(vp-type-supported(<bool>))",false));
058        }
059    }