1 17 18 package org.apache.tools.ant.types; 19 20 import org.apache.tools.ant.BuildFileTest; 21 import org.apache.tools.ant.Project; 22 import org.apache.tools.ant.BuildException; 23 24 public class FlexIntegerTest extends BuildFileTest { 25 26 public FlexIntegerTest(String name) { 27 super(name); 28 } 29 30 public void setUp() { 31 configureProject("src/etc/testcases/types/flexinteger.xml"); 32 } 33 34 public void testFlexInteger() { 35 executeTarget("test"); 36 assertEquals(project.getProperty("flexint.value1"), "10"); 37 assertEquals(project.getProperty("flexint.value2"), "8"); 38 } 39 40 private Project taskProject; 43 String propName; 44 private FlexInteger value; 45 46 49 public FlexIntegerTest() { 50 super("FlexIntegerTest"); 51 } 52 53 public void setPropName(String propName) { 54 this.propName = propName; 55 } 56 57 public void setValue(FlexInteger value) { 58 this.value = value; 59 } 60 61 public void setProject(Project project) { 62 taskProject = project; 63 } 64 65 public void execute() { 66 if (propName == null || value == null) { 67 throw new BuildException("name and value required"); 68 } 69 70 taskProject.setNewProperty(propName, value.toString()); 71 } 72 } 73 | Popular Tags |