Browse Source

some method signatures in IntrospectionHelper have changed.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269270 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
efe6a8f909
1 changed files with 14 additions and 9 deletions
  1. +14
    -9
      src/testcases/org/apache/tools/ant/IntrospectionHelperTest.java

+ 14
- 9
src/testcases/org/apache/tools/ant/IntrospectionHelperTest.java View File

@@ -67,24 +67,31 @@ import java.util.*;


public class IntrospectionHelperTest extends TestCase { public class IntrospectionHelperTest extends TestCase {


private Project p;

public static boolean isUnixStyle = File.pathSeparatorChar == ':'; public static boolean isUnixStyle = File.pathSeparatorChar == ':';


public IntrospectionHelperTest(String name) { public IntrospectionHelperTest(String name) {
super(name); super(name);
} }
public void setUp() {
p = new Project();
p.setBasedir("/tmp");
}

public void testAddText() throws BuildException { public void testAddText() throws BuildException {
IntrospectionHelper ih = IntrospectionHelper.getHelper(java.lang.String.class); IntrospectionHelper ih = IntrospectionHelper.getHelper(java.lang.String.class);
try { try {
ih.addText("", "test");
ih.addText(p, "", "test");
fail("String doesn\'t support addText"); fail("String doesn\'t support addText");
} catch (BuildException be) { } catch (BuildException be) {
} }


ih = IntrospectionHelper.getHelper(getClass()); ih = IntrospectionHelper.getHelper(getClass());
ih.addText(this, "test");
ih.addText(p, this, "test");
try { try {
ih.addText(this, "test2");
ih.addText(p, this, "test2");
fail("test2 shouldn\'t be equal to test"); fail("test2 shouldn\'t be equal to test");
} catch (BuildException be) { } catch (BuildException be) {
assert(be.getException() instanceof AssertionFailedError); assert(be.getException() instanceof AssertionFailedError);
@@ -131,7 +138,7 @@ public class IntrospectionHelperTest extends TestCase {
} catch (BuildException be) { } catch (BuildException be) {
} }
assertEquals(java.lang.String.class, ih.getElementType("six")); assertEquals(java.lang.String.class, ih.getElementType("six"));
assertEquals("test", ih.createElement(this, "six"));
assertEquals("test", ih.createElement(p, this, "six"));


try { try {
ih.getElementType("seven"); ih.getElementType("seven");
@@ -164,17 +171,17 @@ public class IntrospectionHelperTest extends TestCase {
} catch (BuildException be) { } catch (BuildException be) {
} }
assertEquals(java.lang.StringBuffer.class, ih.getElementType("thirteen")); assertEquals(java.lang.StringBuffer.class, ih.getElementType("thirteen"));
assertEquals("test", ih.createElement(this, "thirteen").toString());
assertEquals("test", ih.createElement(p, this, "thirteen").toString());


try { try {
ih.createElement(this, "fourteen");
ih.createElement(p, this, "fourteen");
fail("fourteen throws NullPointerException"); fail("fourteen throws NullPointerException");
} catch (BuildException be) { } catch (BuildException be) {
assert(be.getException() instanceof NullPointerException); assert(be.getException() instanceof NullPointerException);
} }


try { try {
ih.createElement(this, "fourteen");
ih.createElement(p, this, "fourteen");
fail("fifteen throws NullPointerException"); fail("fifteen throws NullPointerException");
} catch (BuildException be) { } catch (BuildException be) {
assert(be.getException() instanceof NullPointerException); assert(be.getException() instanceof NullPointerException);
@@ -245,8 +252,6 @@ public class IntrospectionHelperTest extends TestCase {
} }


public void testAttributeSetters() throws BuildException { public void testAttributeSetters() throws BuildException {
Project p = new Project();
p.setBasedir("/tmp");
IntrospectionHelper ih = IntrospectionHelper.getHelper(getClass()); IntrospectionHelper ih = IntrospectionHelper.getHelper(getClass());
try { try {
ih.setAttribute(p, this, "one", "test"); ih.setAttribute(p, this, "one", "test");


Loading…
Cancel
Save