-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed test status of optional in dataprovider test #256
Conversation
...tsystems/mms/tic/testframework/execution/testng/worker/finish/MethodContextUpdateWorker.java
Show resolved
Hide resolved
log().debug("Asserting '{}' for '{}'", expectedStatus, methodNameSlug); | ||
foundEntries.stream() | ||
.filter(line -> line.contains(expectedStatus.title)) | ||
.findFirst() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would not anyMatch
work just as well here? Or must we discard results after the first?
(value
is unused, so we do not actually need a find
operation.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not work without value
: () -> log().info(...)
--> IntelliJ: Cannot infer functional interface type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it's just a helper class for tests. ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean like this:
if (foundEntries.stream().anyMatch(line -> line.contains(expectedStatus.title))) {
log().info("Found status {}", expectedStatus.title);
}
else {
Assert.fail(String.format("'%s' should have status '%s'", methodNameSlug, expectedStatus));
}
?
value
is unused in ifPresentOrElse
, so we do not actually need a result item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Or alternatively: Did you forget to output value
in the ifPresent
part?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of unique combination of class and method I have one result or nothing.
And value is not needed in output, I dont want to log the whole line. But value must be declared.
...ration-tests/src/main/java/eu/tsystems/mms/tic/testframework/core/utils/Log4jFileReader.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/io/testerra/test/status/CheckTestStatusTest.java
Show resolved
Hide resolved
log().debug("Asserting '{}' for '{}'", expectedStatus, methodNameSlug); | ||
foundEntries.stream() | ||
.filter(line -> line.contains(expectedStatus.title)) | ||
.findFirst() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean like this:
if (foundEntries.stream().anyMatch(line -> line.contains(expectedStatus.title))) {
log().info("Found status {}", expectedStatus.title);
}
else {
Assert.fail(String.format("'%s' should have status '%s'", methodNameSlug, expectedStatus));
}
?
value
is unused in ifPresentOrElse
, so we do not actually need a result item.
Description
In case of optional assertions a testmethod was set to status
SKIPPED
if the test was part of a dataprovider run.Type of change
Please delete options that are not relevant.
Checklist: