Add Assumptions.assumeDoesNotThrow
I wish to skip some of my larger integration tests, if the target environment is not available/healthy.
For that I have to perform a http call. If the environment is not available/running/health, I get an exception. If it is healthy I get an OK-Health status with some additional metadata I slightly care about.
Currently I use the following construct for my assumption check.
try {
List<String> services = cluster.listServices();
assumeThat(services)
.isNotEmpty()
.contains(testServiceName);
[...]
} catch (IncompleteExecutionException e) {
throw e;
} catch (Exception e) {
throw new TestAbortedException("Cluster not properly configured or not available", e);
}
I would like to be able to use the Assumptions here similar to the Assertions.assertDoesNotThrow(...).
List<String> services = assumeDoesNotThrow(cluster::listServices, "Cluster not properly configured or not available");
assumeThat(services)
.isNotEmpty()
.contains(testServiceName);
I'm willing to PR this feature, if it gets accepted.
Tentatively slated for 5.8 M1 for team discussion
Team decision: Your request sounds reasonable, but we're unsure how generally useful it is given it hasn't been requested before. Thus, changing the status to "waiting for interest".
By the way, this has been requested before in https://github.com/junit-team/junit5/issues/1667 . I would also kindly support the request.
Hi @marcphilipp . May I please have a look into this issue? I'd like to try to enhance it.
Team decision: Given our limited capacity, the team has decided to close issues for which there has not been considerable interest.