The following Code of Conduct is based on full compliance with the Apache Software Foundation Code of Conduct.
mvn -U clean package -Prelease
can compile and test through all test cases.result
; each
is used in loops to name loop variables; and entry
is used in map instead of each
.e
; Catch the exception and do nothing, and the exception is named ignored
.equals
and ==
In a conditional expression, the constant is left, the variable is on the right, and in the expression greater than less than condition, the variable is left and the constant is right.final
.null
.LinkedList
and only use ArrayList
if you need to get element values in the collection through the index.ArrayList
,HashMap
that may produce expansion must specify the initial size of the collection to avoid expansion.javadoc
, todo
and fixme
.Test code and production code are subject to the same code specifications.
Unit tests are subject to AIR (Automatic, Independent, Repeatable) Design concept.
System.out
, log
, etc. are not allowed, and must be verified with assertions.Unit tests are subject to BCDE(Border, Correct, Design, Error) Design principles.
If there is no special reason, the test needs to be fully covered.
Each test case needs to be accurately asserted.
Prepare the environment for code separation from the test code.
Only jUnit Assert
,hamcrest CoreMatchers
,Mockito Correlation can use static import.
Single-data assertions should use assertTrue
,assertFalse
,assertNull
and assertNotNull
.
Multi-data assertions should use assertThat
.
Accurate assertion, try not to use not
,containsString
assertion.
The true value of the test case should be named actualXXX, and the expected value should be named expectedXXX.
Classes and Methods with @Test
labels do not require javadoc.
Public specifications.
200
in length, ensuring that each line is semantically complete for easy understanding.