mirror of
https://github.com/sjsdfg/effective-java-3rd-chinese.git
synced 2025-03-03 05:40:50 +08:00
39. 注解优于命名模式
This commit is contained in:
parent
5cc7536c7e
commit
2718522449
@ -98,11 +98,8 @@ public class RunTests {
|
||||
|
||||
```Java
|
||||
public static void Sample.m3() failed: RuntimeException: Boom
|
||||
|
||||
Invalid @Test: public void Sample.m5()
|
||||
|
||||
public static void Sample.m7() failed: RuntimeException: Crash
|
||||
|
||||
Passed: 1, Failed: 3
|
||||
```
|
||||
|
||||
@ -245,11 +242,8 @@ public @interface ExceptionTestContainer {
|
||||
|
||||
```Java
|
||||
// Code containing a repeated annotation
|
||||
|
||||
@ExceptionTest(IndexOutOfBoundsException.class)
|
||||
|
||||
@ExceptionTest(NullPointerException.class)
|
||||
|
||||
public static void doublyBad() { ... }
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user