From fd2327b8bcc472560dd671faf028447876005da9 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Fri, 1 Apr 2016 06:17:09 +0200 Subject: [PATCH] simplification suggested by @silviu-burcea --- .../apache/tools/ant/taskdefs/JavacTest.java | 29 +++---------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java index 67e31e9e8..755921d9e 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java @@ -35,7 +35,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; /** * Testcase for . @@ -249,19 +248,13 @@ public class JavacTest { assertEquals("1.5", javac.getTarget()); } - @Test + @Test(expected = BuildException.class) public void testModulesourcepathOrSrcDirRequired() { - try { javac.checkParameters(); - fail("Build exception should have been thrown - neither srcDir nor modulesourcepath"); - } catch (BuildException e) { - //pass - } } - @Test + @Test(expected = BuildException.class) public void testModulesourcepathAndSrcDirForbidden() { - try { javac.checkParameters(); final Path p = new Path(project); p.setPath("src"); @@ -269,15 +262,10 @@ public class JavacTest { final Path mp = new Path(project); p.setPath("modsrc"); javac.setModulesourcepath(mp); - fail("Build exception should have been thrown - neither srcDir nor modulesourcepath"); - } catch (BuildException e) { - //pass - } } - @Test + @Test(expected = BuildException.class) public void testModulesourcepathAndSourcepathForbidden() { - try { javac.checkParameters(); final Path p = new Path(project); p.setPath("src"); @@ -285,10 +273,6 @@ public class JavacTest { final Path mp = new Path(project); p.setPath("modsrc"); javac.setModulesourcepath(mp); - fail("Build exception should have been thrown - neither srcDir nor modulesourcepath"); - } catch (BuildException e) { - //pass - } } @Test @@ -317,16 +301,11 @@ public class JavacTest { } } - @Test + @Test(expected = BuildException.class) public void testModulesourcepathRequiresDestdir() { - try { final Path p = new Path(project); p.setPath("src"); javac.setModulesourcepath(p); javac.checkParameters(); - fail("Build exception should have been thrown - modulesourcepath requires destdir"); - } catch (BuildException e) { - //pass - } } }