File tree Expand file tree Collapse file tree 3 files changed +12
-19
lines changed
oca/src/test/java/io/mincong/ocajp/chapter3 Expand file tree Collapse file tree 3 files changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -20,13 +20,13 @@ jobs:
2020 key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
2121 restore-keys : ${{ runner.os }}-m2
2222 - run : mvn verify
23- Java-14 :
23+ Java-15 :
2424 runs-on : ubuntu-latest
2525 steps :
2626 - uses : actions/checkout@v2
2727 - uses : actions/setup-java@v1
2828 with :
29- java-version : 14
29+ java-version : 15
3030 - uses : actions/cache@v1
3131 with :
3232 path : ~/.m2
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ in different frameworks. You can run these tests using:
66
77 mvn clean install
88
9- This project is tested under Java 11 and Java 14 .
9+ This project is tested under Java 11 and Java 15 .
1010
1111## Module List
1212
Original file line number Diff line number Diff line change 11package io .mincong .ocajp .chapter3 ;
22
3- import static org .junit .Assert .assertEquals ;
4- import static org .junit .Assert .assertNull ;
5- import static org .junit .Assert .assertSame ;
6- import static org .junit .Assert .assertTrue ;
7- import static org .junit .Assert .fail ;
8-
9- import java .util .ArrayList ;
10- import java .util .Arrays ;
11- import java .util .Collections ;
12- import java .util .List ;
3+ import static org .junit .Assert .*;
4+
5+ import java .util .*;
136import java .util .stream .Collectors ;
147import java .util .stream .Stream ;
158import org .junit .Test ;
@@ -77,12 +70,12 @@ public void testAutoboxing() {
7770 weights .add (new Double (60 )); // ok
7871
7972 weights .add (null );
80- try {
81- double w = weights . get ( 2 ); // cannot unwrap
82- fail ();
83- } catch ( NullPointerException e ) {
84- assertNull ( e . getMessage ());
85- }
73+ assertThrows (
74+ NullPointerException . class ,
75+ () -> {
76+ @ SuppressWarnings ( "unused" )
77+ double w = weights . get ( 2 ); // cannot unwrap null
78+ });
8679 }
8780
8881 @ Test
You can’t perform that action at this time.
0 commit comments