1 17 package org.apache.tools.ant.types; 18 19 import org.apache.tools.ant.BuildFileTest; 20 21 24 public class AssertionsTest extends BuildFileTest { 25 26 public AssertionsTest(String name) { 27 super(name); 28 } 29 30 protected void setUp() throws Exception { 31 configureProject("src/etc/testcases/types/assertions.xml"); 32 } 33 34 protected void tearDown() throws Exception { 35 executeTarget("teardown"); 36 } 37 38 42 protected void expectAssertion(String target) { 43 expectBuildExceptionContaining(target, 44 "assertion not thrown in "+target, 45 "Java returned: 1"); 46 } 47 48 public void testClassname() { 49 expectAssertion("test-classname"); 50 } 51 52 public void testPackage() { 53 expectAssertion("test-package"); 54 } 55 56 public void testEmptyAssertions() { 57 executeTarget("test-empty-assertions"); 58 } 59 60 public void testDisable() { 61 executeTarget("test-disable"); 62 } 63 64 public void testOverride() { 65 expectAssertion("test-override"); 66 } 67 68 public void testOverride2() { 69 executeTarget("test-override2"); 70 } 71 public void testReferences() { 72 expectAssertion("test-references"); 73 } 74 75 public void testMultipleAssertions() { 76 expectBuildExceptionContaining("test-multiple-assertions", 77 "multiple assertions rejected", 78 "Only one assertion declaration is allowed"); 79 } 80 81 public void testReferenceAbuse() { 82 expectBuildExceptionContaining("test-reference-abuse", 83 "reference abuse rejected", 84 "You must not specify more than one attribute when using refid"); 85 } 86 87 public void testNofork() { 88 expectLogContaining("test-nofork", 89 "Assertion statements are currently ignored in non-forked mode"); 90 } 91 92 93 } 94 95 96 | Popular Tags |