Taher-Ghaleb opened a new pull request, #1751:
URL: https://github.com/apache/karaf/pull/1751

   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 first smell is when inappropriate assertions are used, while there exist 
better alternatives. For example, in 
[GuardProxyCatalogTest.java](https://github.com/apache/karaf/commit/d0456624885a9bff8d4418614b1e8469981c26c3#diff-de2cfbdc07af433a0de11f25b23069dabd16eba9eb4e3157701fbd89562c10b7),
 I refactored 
`assertTrue(!GuardProxyCatalog.PROXY_CREATOR_THREAD_NAME.equals(t.getName()));` 
using `assertNotEquals(GuardProxyCatalog.PROXY_CREATOR_THREAD_NAME, 
t.getName());`.
   
   The second smell is when exception handling can alternatively be implemented 
using assertion rather than annotation. For example, in 
[EventSendCommandTest.java](https://github.com/apache/karaf/commit/100420f757c2bd6fe00a8d28c14a1388d665b8fe#diff-80c4f1284affb61c43d9458dcb2580b0c7d770415291e34238bfc238a7cf6451),
 I used `assertThrows(IllegalArgumentException.class, () -> {...});` instead of 
`@Test(expected=IllegalArgumentException.class)`.
   
   While there could be several cases like this, we aim in this pull request to 
get your feedback on these particular test smells and their refactorings. 
Thanks in advance for your input.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@karaf.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to