diff --git a/src/test/java/com/xceptance/neodymium/tests/NeodymiumTest.java b/src/test/java/com/xceptance/neodymium/tests/NeodymiumTest.java index 311617da9..003f5697b 100644 --- a/src/test/java/com/xceptance/neodymium/tests/NeodymiumTest.java +++ b/src/test/java/com/xceptance/neodymium/tests/NeodymiumTest.java @@ -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) { @@ -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 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 expectedFailureMessages) { final Optional 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()); @@ -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) {