[
https://issues.apache.org/jira/browse/HADOOP-18866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759117#comment-17759117
]
Steve Loughran commented on HADOOP-18866:
-----------------------------------------
because they are existing tests, they find regressions and rewriting test code
just because that the existing style is out of fashion is hard to justify.
why bother? doesn't improve test coverage or diagnostics; get it wrong and
either you have a false positive (test failure) or false negative (misses
regressions). it is stable code.
# new tests, no; there'd we want intercept() and assertj. using assertj over
junit5 asserts helps us to backport things to older branches without reworking
the tests.
# as part of ongoing changes to existing tests -yes.
# a bulk replace of (expected = to intercept()? well, we are always scared of
big changes. look at the commit history of moving to junit5
> Refactor @Test(expected) with assertThrows
> ------------------------------------------
>
> Key: HADOOP-18866
> URL: https://issues.apache.org/jira/browse/HADOOP-18866
> Project: Hadoop Common
> Issue Type: Improvement
> Reporter: Taher Ghaleb
> Priority: Minor
> Labels: pull-request-available
>
> I am working on research that investigates test smell refactoring in which we
> identify alternative implementations of test cases, study how commonly used
> these refactorings are, and assess how acceptable they are in practice.
> The smell occurs when exception handling can alternatively be implemented
> using assertion rather than annotation: using {{assertThrows(Exception.class,
> () -> \{...});}} instead of {{{}@Test(expected = Exception.class){}}}.
> While there are many cases like this, we aim in this pull request to get your
> feedback on this particular test smell and its refactoring. Thanks in advance
> for your input.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]