33import static org .hamcrest .CoreMatchers .containsString ;
44import static org .hamcrest .CoreMatchers .equalTo ;
55import static org .hamcrest .MatcherAssert .assertThat ;
6- import static org .junit .Assert .assertArrayEquals ;
7- import static org .junit .Assert .assertEquals ;
8- import static org .junit .Assert .assertFalse ;
9- import static org .junit .Assert .assertNotEquals ;
10- import static org .junit .Assert .assertNotNull ;
11- import static org .junit .Assert .assertNull ;
12- import static org .junit .Assert .assertThrows ;
13- import static org .junit .Assert .assertTrue ;
6+ import static org .junit .jupiter . api . Assertions .assertArrayEquals ;
7+ import static org .junit .jupiter . api . Assertions .assertEquals ;
8+ import static org .junit .jupiter . api . Assertions .assertFalse ;
9+ import static org .junit .jupiter . api . Assertions .assertNotEquals ;
10+ import static org .junit .jupiter . api . Assertions .assertNotNull ;
11+ import static org .junit .jupiter . api . Assertions .assertNull ;
12+ import static org .junit .jupiter . api . Assertions .assertThrows ;
13+ import static org .junit .jupiter . api . Assertions .assertTrue ;
1414
1515import java .io .File ;
1616import java .io .IOException ;
2727import java .util .Map ;
2828import java .util .Vector ;
2929import java .util .concurrent .ConcurrentHashMap ;
30- import org .junit .After ;
31- import org .junit .Before ;
32- import org .junit .Test ;
30+ import org .junit .jupiter . api . AfterEach ;
31+ import org .junit .jupiter . api . BeforeEach ;
32+ import org .junit .jupiter . api . Test ;
3333
3434public class ReaderTest {
3535 private Reader testReader ;
3636
37- @ Before
37+ @ BeforeEach
3838 public void setupReader () {
3939 this .testReader = null ;
4040 }
4141
42- @ After
42+ @ AfterEach
4343 public void teardownReader () throws IOException {
4444 if (this .testReader != null ) {
4545 this .testReader .close ();
@@ -93,9 +93,11 @@ public void testNetworks() throws IOException, InvalidDatabaseException, Invalid
9393
9494 InetAddress actualIPInData = InetAddress .getByName (data .get ("ip" ));
9595
96- assertEquals ("expected ip address" ,
96+ assertEquals (
9797 iteration .getNetwork ().getNetworkAddress (),
98- actualIPInData );
98+ actualIPInData ,
99+ "expected ip address"
100+ );
99101 }
100102
101103 reader .close ();
@@ -1208,7 +1210,7 @@ private void testMetadata(Reader reader, int ipVersion, long recordSize) {
12081210
12091211 Metadata metadata = reader .getMetadata ();
12101212
1211- assertEquals ("major version" , 2 , metadata .getBinaryFormatMajorVersion ());
1213+ assertEquals (2 , metadata .getBinaryFormatMajorVersion (), "major version" );
12121214 assertEquals (0 , metadata .getBinaryFormatMinorVersion ());
12131215 assertEquals (ipVersion , metadata .getIpVersion ());
12141216 assertEquals ("Test" , metadata .getDatabaseType ());
@@ -1237,8 +1239,11 @@ private void testIpV4(Reader reader, File file) throws IOException {
12371239 Map <String , String > data = new HashMap <>();
12381240 data .put ("ip" , address );
12391241
1240- assertEquals ("found expected data record for " + address + " in "
1241- + file , data , reader .get (InetAddress .getByName (address ), Map .class ));
1242+ assertEquals (
1243+ data ,
1244+ reader .get (InetAddress .getByName (address ), Map .class ),
1245+ "found expected data record for " + address + " in " + file
1246+ );
12421247 }
12431248
12441249 Map <String , String > pairs = new HashMap <>();
@@ -1253,8 +1258,11 @@ private void testIpV4(Reader reader, File file) throws IOException {
12531258 Map <String , String > data = new HashMap <>();
12541259 data .put ("ip" , pairs .get (address ));
12551260
1256- assertEquals ("found expected data record for " + address + " in "
1257- + file , data , reader .get (InetAddress .getByName (address ), Map .class ));
1261+ assertEquals (
1262+ data ,
1263+ reader .get (InetAddress .getByName (address ), Map .class ),
1264+ "found expected data record for " + address + " in " + file
1265+ );
12581266 }
12591267
12601268 for (String ip : new String [] {"1.1.1.33" , "255.254.253.123" }) {
@@ -1271,8 +1279,11 @@ private void testIpV6(Reader reader, File file) throws IOException {
12711279 Map <String , String > data = new HashMap <>();
12721280 data .put ("ip" , address );
12731281
1274- assertEquals ("found expected data record for " + address + " in "
1275- + file , data , reader .get (InetAddress .getByName (address ), Map .class ));
1282+ assertEquals (
1283+ data ,
1284+ reader .get (InetAddress .getByName (address ), Map .class ),
1285+ "found expected data record for " + address + " in " + file
1286+ );
12761287 }
12771288
12781289 Map <String , String > pairs = new HashMap <>();
@@ -1289,8 +1300,11 @@ private void testIpV6(Reader reader, File file) throws IOException {
12891300 Map <String , String > data = new HashMap <>();
12901301 data .put ("ip" , pairs .get (address ));
12911302
1292- assertEquals ("found expected data record for " + address + " in "
1293- + file , data , reader .get (InetAddress .getByName (address ), Map .class ));
1303+ assertEquals (
1304+ data ,
1305+ reader .get (InetAddress .getByName (address ), Map .class ),
1306+ "found expected data record for " + address + " in " + file
1307+ );
12941308 }
12951309
12961310 for (String ip : new String [] {"1.1.1.33" , "255.254.253.123" , "89fa::" }) {
0 commit comments