Please see my answer to Martin Gainty, it proofs there is no NPE but 
AssumptionViolatedException. It is a wrong assumption that all thrown 
exceptions lead to test fail. It is JUnit's normal behavior that 
Assume.assumeTrue(false) will throw AssumptionViolatedException, so that one 
explicitly needs special treatment to skip the test, as this is the intention 
of that JUnit API.
-Markus


-----Ursprüngliche Nachricht-----
Von: John Patrick [mailto:nhoj.patr...@gmail.com] 
Gesendet: Sonntag, 16. August 2020 14:47
An: Maven Developers List
Betreff: Re: Assumption fail treated as unexcepted exception?!

If the code working out the assumption fails and causes a throwable,
either Runtime or Checked, I would expect the test to fail.
If you have a line something like below, and that causes a test error,
then that feels wrong as it's a valid assumption.
Assumptions.assumeFalse("ABC".equals("ABC"), "message");

But if you had below, which would throw an NPE, then that should error
as it's a badly coded assumption logic.
String IS_NULL = null;
Assumptions.assumeFalse(IS_NULL.equals("ABC"), "message");

So without seeing the test involved it's hard to tell if it's correct or not.

John

On Sun, 16 Aug 2020 at 13:31, Martin Gainty <mgai...@hotmail.com> wrote:
>
> MG>below
>
> ________________________________
> From: Markus KARG <mar...@headcrashing.eu>
> Sent: Sunday, August 16, 2020 7:40 AM
> To: dev@maven.apache.org <dev@maven.apache.org>
> Subject: Assumption fail treated as unexcepted exception?!
>
> Guys,
>
>
>
> I'm stuck with working on a new feature due to this, so I hope you can help
> me quickly:
>
>
>
> JUnit knows assumptions, assertions and exceptions. Failing assertions will
> FAIL tests (hence will fail maven builds). Failing assumptions will SKIP
> tests (hence will pass maven builds). Exceptions will ERROR tests (hence
> will break maven builds). Unfortunately today I noticed that assumptions
> actually ERROR test (hence fail builds) in Maven!
>
>
>
> (I simply added another test to maven dependency plugin which contains an
> always-failing assumption to proof the claim)
>
>
>
> [INFO] Results:
>
> [INFO]
>
> [ERROR] Errors:
>
> [ERROR]   TestCopyMojo.proofClaim:274 ┐ AssumptionViolated always skip
>
> MG>get maven environment and debug information
> MG>mvn -e -X
> MG>also I know Junit 5.4.2 needs Hamcrest to be on classpath
> MG>can you tell us which version of Junit you are using?
>
> -Markus Karg
> ~gruss~
> ~martin~
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to