001    package org.hackystat.sensor.xmldata.option;
002    
003    import java.util.ArrayList;
004    import java.util.List;
005    
006    import org.hackystat.sensor.xmldata.XmlDataController;
007    import org.junit.Assert;
008    import org.junit.Test;
009    
010    /**
011     * Tests if the resource option accepts and processes the correct arguments.
012     * @author aito
013     * 
014     */
015    public class TestResourceOption {
016      /**
017       * Tests if isValid returns the correct value depending on the specified
018       * parameters.
019       */
020      @Test
021      public void testIsValid() {
022        XmlDataController controller = new XmlDataController();
023        // Tests a valid sdt option.
024        List<String> arguments = new ArrayList<String>();
025        arguments.add("C:\\Foo.java");
026        Option resourceOption = OptionFactory.getInstance(controller, ResourceOption.OPTION_NAME,
027            arguments);
028        Assert.assertTrue("Resource Options accept only 1 argument.", resourceOption.isValid());
029    
030        // Tests an invalid sdt option.
031        resourceOption = new ResourceOption(controller, new ArrayList<String>());
032        Assert.assertFalse("Resource Options must have 1 argument.", resourceOption.isValid());
033      }
034    }