Skip to content

Commit

Permalink
#121: added java doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Pfotenhauer committed Aug 31, 2020
1 parent 1b1ba60 commit a4e192d
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/test/java/com/xceptance/neodymium/tests/NeodymiumTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public static void cleanUp()

/**
* delete a temporary test file
*
* @param tempFile
* the tempFile that should be deleted after test execution
*/
public static void deleteTempFile(final File tempFile)
{
Expand All @@ -56,15 +59,30 @@ public static void deleteTempFile(final File tempFile)
}
}

public void check(final Result result, final boolean expectedSuccessful, final int expectedRunCount, final int expectedIgnoreCount,
final int expectedFailCount,
final Map<String, String> expectedFailureMessages)
/**
* Basic method to perform assertions on a given test result.
*
* @param result
* test result to validate
* @param expectSuccessful
* the test result should be successful
* @param expectedRunCount
* expected number of run tests (including ignored)
* @param expectedIgnoreCount
* expected number of ignored tests
* @param expectedFailCount
* expected number of failed tests
* @param expectedFailureMessages
* expected message of all failures (same message for each failure)
*/
public void check(final Result result, final boolean expectSuccessful, final int expectedRunCount, final int expectedIgnoreCount,
final int expectedFailCount, final Map<String, String> expectedFailureMessages)
{
final Optional<String> accumulatedTrace = result.getFailures().stream().map(Failure::getTrace).reduce(String::concat);
final String stackTrace = accumulatedTrace.orElse("n/a");
try
{
Assert.assertEquals("Test successful", expectedSuccessful, result.wasSuccessful());
Assert.assertEquals("Test successful", expectSuccessful, result.wasSuccessful());
Assert.assertEquals("Method run count", expectedRunCount, result.getRunCount());
Assert.assertEquals("Method ignore count", expectedIgnoreCount, result.getIgnoreCount());
Assert.assertEquals("Method fail count", expectedFailCount, result.getFailureCount());
Expand All @@ -78,7 +96,6 @@ public void check(final Result result, final boolean expectedSuccessful, final i
Assert.assertEquals("Failure message", expectedFailureMessages.get(methodName), result.getFailures().get(i).getMessage());
}
}

}
catch (AssertionError e)
{
Expand Down

0 comments on commit a4e192d

Please sign in to comment.