Document the static imports (style guidelines) (#2161)
* document the static imports that we like * spotless * Update docs/contributing/style-guideline.md Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com> Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
This commit is contained in:
parent
48a0772f3a
commit
66dc6c934f
|
@ -52,3 +52,17 @@ To run these checks locally:
|
|||
```
|
||||
./gradlew checkstyleMain checkstyleTest
|
||||
```
|
||||
|
||||
### Static imports
|
||||
|
||||
We leverage static imports for many common types of operations. However, not all static methods or
|
||||
constants are necessarily good candidates for a static import. The following list is a very
|
||||
rough guideline of what are commonly accepted static imports:
|
||||
|
||||
* Test assertions (JUnit and AssertJ)
|
||||
* Mocking/stubbing in tests (with Mockito)
|
||||
* Collections helpers (such as `singletonList()` and `Collectors.toList()`)
|
||||
* ByteBuddy `ElementMatchers` (for building instrumentation modules)
|
||||
* Immutable constants (where clearly named)
|
||||
* Singleton instances (especially where clearly named an hopefully immutable)
|
||||
* `tracer()` methods that expose tracer singleton instances
|
||||
|
|
Loading…
Reference in New Issue