📄 testdir.java
字号:
package org.momeunit.ant.taskdefs;import org.apache.tools.ant.Task;import org.apache.tools.ant.types.FileSet;import org.momeunit.ant.core.Utility;/** * MoMEUnit nested tag intended to specify files to be scanned for test cases and * to be included in resulting test J2ME application. Extends {@link FileSet}. * Adds if/unless functionality. Implements {@link TestElement}. * * @author Sergio Morozov * @version 1.1.2 */public class TestDir extends FileSet implements TestElement{ public static final String DEFAULT_TEST_TYPE = "class"; private String pattern = null; private TestType type = new TestType(DEFAULT_TEST_TYPE); private boolean onlyTests = true; private String ifProp = null; private String unlessProp = null; /* * (non-Javadoc) * * @see org.momeunit.ant.taskdefs.TestElement#getPattern() */ public String getPattern() { return this.pattern; } /* * (non-Javadoc) * * @see org.momeunit.ant.taskdefs.TestElement#setPattern(java.lang.String) */ public void setPattern(String pattern) { Utility.assertNotEmpty(pattern, "pattern", "testdir"); this.pattern = pattern; } /* * (non-Javadoc) * * @see org.momeunit.ant.taskdefs.TestElement#getFileSet() */ public FileSet getFileSet() { return this; } /* * (non-Javadoc) * * @see org.momeunit.ant.taskdefs.TestElement#getType() */ public String getType() { return this.type.getValue(); } /* * (non-Javadoc) * * @see org.momeunit.ant.taskdefs.TestElement#containsClasses() */ public boolean containsClasses() { return this.type.containsClasses(); } /** * Sets type of classes designated by <code><testdir></code> nested * tag. * * @param type * type of classes designated by this tag. * @since 1.1 */ public void setType(String type) { Utility.assertNotEmpty(type, "type", "testdir"); this.type.setValue(type); } /* * (non-Javadoc) * * @see org.momeunit.ant.taskdefs.TestElement#isOnlyTests() */ public boolean isOnlyTests() { return this.onlyTests; } /* * (non-Javadoc) * * @see org.momeunit.ant.taskdefs.TestElement#setOnlyTests(boolean) */ public void setOnlyTests(boolean onlyTests) { this.onlyTests = onlyTests; } /** * Sets name of property to be set to allow this element. * * @param ifProp * name of property to be set to allow this element. * @since 1.1 */ public void setIf(String ifProp) { Utility.assertNotEmpty(ifProp, "if", "testdir"); this.ifProp = ifProp; } /** * Sets name of property to be unset to allow this element. * * @param unlessProp * name of property to be unset to allow this element. * @since 1.1 */ public void setUnless(String unlessProp) { Utility.assertNotEmpty(unlessProp, "unless", "testdir"); this.unlessProp = unlessProp; } /* * (non-Javadoc) * * @see org.momeunit.ant.taskdefs.TestElement#shouldUse(org.apache.tools.ant.Task) */ public boolean shouldUse(Task task) { return (ifProp == null || task.getProject().getProperty(ifProp) != null) && (unlessProp == null || task.getProject().getProperty(unlessProp) == null); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -