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 SdtOption operates as intended. 012 * @author aito 013 * 014 */ 015 public class TestSdtOption { 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("DevEvent"); 026 Option sdtOption = OptionFactory.getInstance(controller, SdtOption.OPTION_NAME, arguments); 027 Assert.assertTrue("SdtOptions accept only 1 argument.", sdtOption.isValid()); 028 029 // Tests an invalid sdt option. 030 sdtOption = new SdtOption(controller, new ArrayList<String>()); 031 Assert.assertFalse("SdtOptions must have 1 argument.", sdtOption.isValid()); 032 } 033 }