Skip to content

Commit

Permalink
remove deprecated boxing
Browse files Browse the repository at this point in the history
  • Loading branch information
angryziber committed Feb 11, 2023
1 parent efa5690 commit 2f6b24e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions test/net/azib/ipscan/core/ScannerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public Object scan(ScanningSubject subject) {
subject.setResultType(ResultType.ALIVE);

// try to set parameter here and read from another Fetcher
subject.setParameter("megaParam", new Long(211082));
subject.setParameter("megaParam", 211082L);
}
catch (UnknownHostException e) {
fail();
Expand All @@ -132,7 +132,7 @@ public void cleanup() {
private class AnotherFakeFetcher extends FakeFetcher {
public Object scan(ScanningSubject subject) {
// the parameter was set by FakeFetcher
assertEquals(new Long(211082), subject.getParameter("megaParam"));
assertEquals(211082L, subject.getParameter("megaParam"));
// try null as a return value
return null;
}
Expand Down
10 changes: 5 additions & 5 deletions test/net/azib/ipscan/core/ScanningResultListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,18 @@ public void testGetResultAsString() throws Exception {
String s = scanningResults.getResult(0).toString();
String ln = System.getProperty("line.separator");
assertTrue(s.endsWith(ln));
assertTrue(s.indexOf(fetchers.get(0).getName() + ":\t172.28.43.55" + ln) >= 0);
assertTrue(s.indexOf(fetchers.get(1).getName() + ":\t123" + ln) >= 0);
assertTrue(s.indexOf(fetchers.get(2).getName() + ":\txxxxx" + ln) >= 0);
assertTrue(s.indexOf(fetchers.get(3).getName() + ":\t" + ln) >= 0);
assertTrue(s.contains(fetchers.get(0).getName() + ":\t172.28.43.55" + ln));
assertTrue(s.contains(fetchers.get(1).getName() + ":\t123" + ln));
assertTrue(s.contains(fetchers.get(2).getName() + ":\txxxxx" + ln));
assertTrue(s.contains(fetchers.get(3).getName() + ":\t" + ln));
}

@Test
public void testFindText() throws Exception {
scanningResults.registerAtIndex(0, scanningResults.createResult(InetAddress.getByName("127.9.9.1")));
scanningResults.getResult(0).setValue(1, NotScanned.VALUE);
scanningResults.registerAtIndex(1, scanningResults.createResult(InetAddress.getByName("127.9.9.2")));
scanningResults.getResult(1).setValue(1, new Long(123456789L));
scanningResults.getResult(1).setValue(1, 123456789L);
scanningResults.registerAtIndex(2, scanningResults.createResult(InetAddress.getByName("127.9.9.3")));
scanningResults.getResult(2).setValue(1, "zzzz");
scanningResults.registerAtIndex(3, scanningResults.createResult(InetAddress.getByName("127.9.9.4")));
Expand Down
2 changes: 1 addition & 1 deletion test/net/azib/ipscan/exporters/CSVExporterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void testCSVSafeString() {
assertEquals("", ((CSVExporter)exporter).csvSafeString(""));
assertEquals("uuuuhha;", ((CSVExporter)exporter).csvSafeString("uuuuhha;"));
assertEquals("", ((CSVExporter)exporter).csvSafeString(null));
assertEquals("123", ((CSVExporter)exporter).csvSafeString(new Long(123)));
assertEquals("123", ((CSVExporter)exporter).csvSafeString(123L));
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion test/net/azib/ipscan/exporters/TXTExporterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void testPad() {
assertEquals(" ", ((TXTExporter)exporter).pad("", 0));
assertEquals("abc ", ((TXTExporter)exporter).pad("abc", 20));
assertEquals(" ", ((TXTExporter)exporter).pad(null, 5));
assertEquals("5 ", ((TXTExporter)exporter).pad(new Integer(5), 5));
assertEquals("5 ", ((TXTExporter)exporter).pad(5, 5));
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions test/net/azib/ipscan/exporters/XMLExporterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public void testFeederInfoNoName() throws IOException {
public void testValidXML() throws Exception {
exporter.start(outputStream, "<megaInfo'''");
exporter.setFetchers(new String[] {"IP", "hello", "fet::cher2"});
exporter.nextAddressResults(new Object[] {InetAddress.getLocalHost().getHostAddress(), "w?:orld'", new Integer(53)});
exporter.nextAddressResults(new Object[] {InetAddress.getLocalHost().getHostAddress(), "bug>>a", new Integer(-1)});
exporter.nextAddressResults(new Object[] {InetAddress.getLocalHost().getHostAddress(), "w?:orld'", 53});
exporter.nextAddressResults(new Object[] {InetAddress.getLocalHost().getHostAddress(), "bug>>a", -1});
exporter.end();
assertContains("<megaInfo'''");

Expand Down
10 changes: 5 additions & 5 deletions test/net/azib/ipscan/feeders/FeederTestUtils.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package net.azib.ipscan.feeders;

import junit.framework.Assert;
import net.azib.ipscan.config.Labels;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

/**
* FeederTestUtils
*
* @author Anton Keks
*/
public class FeederTestUtils {

public static void assertFeederException(String message, FeederException e) {
// assert that the message is correct
Assert.assertEquals(message, e.getMessage());
assertEquals(message, e.getMessage());
// check that corresponding label exists
Assert.assertNotNull(Labels.getLabel("exception.FeederException." + message));
assertNotNull(Labels.getLabel("exception.FeederException." + message));
}

}

0 comments on commit 2f6b24e

Please sign in to comment.