Changes for page Java Unit Testing

Last modified by Vincent Massol on 2023/05/03 15:57

<
From version < 7.2 >
edited by Vincent Massol
on 2018/11/25 11:40
To version < 8.1 >
edited by Vincent Massol
on 2018/11/27 15:47
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -349,7 +349,8 @@
349 349  = Best practices =
350 350  
351 351  * Name the Test class with the name of the class under test **suffixed with ##Test##**. For example the JUnit test class for ##XWikiMessageTool## should be named ##XWikiMessageToolTest##
352 -* Name the test methods with the method to test followed by a qualifier describing the test. For example ##importWithHeterogeneousEncodings()##.
352 +* Have each test method test only 1 use case as much as possible.
353 +* Name the test methods with the method to test followed by a qualifier describing the test. For example ##importWithHeterogeneousEncodings()##. In the few cases where it's not applicable, name after the use case being tested.
353 353  * When you're testing for an exception, use the following strategy, shown on an example:(((
354 354  {{code language="java"}}
355 355  Throwable exception = assertThrows(IllegalArgumentException.class, () -> {

Get Connected