Browse Source

"Move" test object to inner class.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@463712 13f79535-47bb-0310-9956-ffa450edef68
master
Jan Materne 18 years ago
parent
commit
875d44b517
3 changed files with 10 additions and 32 deletions
  1. +1
    -1
      build.xml
  2. +9
    -7
      src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java
  3. +0
    -24
      src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest_Factory.java

+ 1
- 1
build.xml View File

@@ -1697,7 +1697,7 @@ see ${build.junit.reports} / ${antunit.reports}
if="junit.batch">

<property name="junit.includes" value="**/*Test*" />
<property name="junit.excludes" value="**/*Test_*" />
<property name="junit.excludes" value="" />

<test-junit>
<formatter type="brief" usefile="false"/>


+ 9
- 7
src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java View File

@@ -48,14 +48,10 @@ public class EnumeratedAttributeTest extends TestCase {
}

public void testFactory() {
EnumeratedAttributeTest_Factory ea1 = (EnumeratedAttributeTest_Factory)EnumeratedAttribute.getInstance(
EnumeratedAttributeTest_Factory.class,
"one");
assertEquals("Factory didnt set the right value.", ea1.getValue(), "one");
Factory ea = (Factory)EnumeratedAttribute.getInstance(Factory.class, "one");
assertEquals("Factory did not set the right value.", ea.getValue(), "one");
try {
EnumeratedAttributeTest_Factory ea2 = (EnumeratedAttributeTest_Factory)EnumeratedAttribute.getInstance(
EnumeratedAttributeTest_Factory.class,
"illegal");
EnumeratedAttribute.getInstance(Factory.class, "illegal");
fail("Factory should fail when trying to set an illegal value.");
} catch (BuildException be) {
// was expected
@@ -96,5 +92,11 @@ public class EnumeratedAttributeTest extends TestCase {
return null;
}
}

public static class Factory extends EnumeratedAttribute {
public String[] getValues() {
return new String[] { "one", "two", "three" };
}
}
}

+ 0
- 24
src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest_Factory.java View File

@@ -1,24 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.tools.ant.types;
public class EnumeratedAttributeTest_Factory extends EnumeratedAttribute {
public String[] getValues() {
return new String[] { "one", "two", "three" };
}
}

Loading…
Cancel
Save