Making test failure message more meaningful (including full stacktrace)

This commit is contained in:
Joakim Erdfelt 2014-11-20 09:52:33 -07:00
parent 2020e07243
commit df9414eab2
1 changed files with 8 additions and 10 deletions

View File

@ -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
{
expectedException.expect(UsageException.class);
expectedException.expectMessage(containsString(expectedErrorMessage));
main.processCommandLine(cmdLine);
fail("Expected " + UsageException.class.getName());
}
catch (UsageException e)
{
assertThat("Usage error",e.getMessage(),containsString(expectedErrorMessage));
}
}
@Test