public void testElementCreators() throws BuildException { IntrospectionHelper ih = IntrospectionHelper.getHelper(getClass()); try { ih.getElementType("one"); fail("don't have element type one"); } catch (BuildException be) { } try { ih.getElementType("two"); fail("createTwo takes arguments"); } catch (BuildException be) { } try { ih.getElementType("three"); fail("createThree returns void"); } catch (BuildException be) { } try { ih.getElementType("four"); fail("createFour returns array"); } catch (BuildException be) { } try { ih.getElementType("five"); fail("createFive returns primitive type"); } catch (BuildException be) { } assertEquals(java.lang.String.class, ih.getElementType("six")); assertEquals("test", ih.createElement(this, "six")); try { ih.getElementType("seven"); fail("addSeven takes two arguments"); } catch (BuildException be) { } try { ih.getElementType("eight"); fail("addEight takes no arguments"); } catch (BuildException be) { } try { ih.getElementType("nine"); fail("nine return non void"); } catch (BuildException be) { } try { ih.getElementType("ten"); fail("addTen takes array argument"); } catch (BuildException be) { } try { ih.getElementType("eleven"); fail("addTen takes primitive argument"); } catch (BuildException be) { } try { ih.getElementType("twelve"); fail("no primitive constructor for java.lang.Class"); } catch (BuildException be) { } assertEquals(java.lang.StringBuffer.class, ih.getElementType("thirteen")); assertEquals("test", ih.createElement(this, "thirteen").toString()); try { ih.createElement(this, "fourteen"); fail("fourteen throws NullPointerException"); } catch (BuildException be) { assertTrue(be.getException() instanceof NullPointerException); } try { ih.createElement(this, "fourteen"); fail("fifteen throws NullPointerException"); } catch (BuildException be) { assertTrue(be.getException() instanceof NullPointerException); } }