Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2014-11-20 16:52:33 +0000
committerJoakim Erdfelt2014-11-20 16:52:33 +0000
commitdf9414eab2dbe0778ea64d7e7349a93aced5930e (patch)
tree31274b8578b6f076ae004ca4cf19f65e90941eb2 /jetty-start
parent2020e0724359a5dad76f6c1c5f8dd38db42a42cf (diff)
downloadorg.eclipse.jetty.project-df9414eab2dbe0778ea64d7e7349a93aced5930e.tar.gz
org.eclipse.jetty.project-df9414eab2dbe0778ea64d7e7349a93aced5930e.tar.xz
org.eclipse.jetty.project-df9414eab2dbe0778ea64d7e7349a93aced5930e.zip
Making test failure message more meaningful (including full stacktrace)
Diffstat (limited to 'jetty-start')
-rw-r--r--jetty-start/src/test/java/org/eclipse/jetty/start/TestBadUseCases.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/TestBadUseCases.java b/jetty-start/src/test/java/org/eclipse/jetty/start/TestBadUseCases.java
index 458ce4d083..bddb9cbba8 100644
--- a/jetty-start/src/test/java/org/eclipse/jetty/start/TestBadUseCases.java
+++ b/jetty-start/src/test/java/org/eclipse/jetty/start/TestBadUseCases.java
@@ -19,20 +19,24 @@
package org.eclipse.jetty.start;
import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
/**
* Test bad configuration scenarios.
*/
public class TestBadUseCases
{
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
private void assertBadConfig(String homeName, String baseName, String expectedErrorMessage, String... cmdLineArgs) throws Exception
{
File homeDir = MavenTestingUtils.getTestResourceDir("usecases/" + homeName);
@@ -48,15 +52,9 @@ public class TestBadUseCases
cmdLine.add(arg);
}
- try
- {
- main.processCommandLine(cmdLine);
- fail("Expected " + UsageException.class.getName());
- }
- catch (UsageException e)
- {
- assertThat("Usage error",e.getMessage(),containsString(expectedErrorMessage));
- }
+ expectedException.expect(UsageException.class);
+ expectedException.expectMessage(containsString(expectedErrorMessage));
+ main.processCommandLine(cmdLine);
}
@Test

Back to the top