mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
add basic test for importing of results
This commit is contained in:
parent
8a6f728dd2
commit
d518ea685e
@ -3,13 +3,17 @@
|
||||
*/
|
||||
package net.azib.ipscan.exporters;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.azib.ipscan.config.Version;
|
||||
import net.azib.ipscan.core.ScanningResult;
|
||||
import net.azib.ipscan.gui.feeders.AbstractFeederGUI;
|
||||
import org.junit.Test;
|
||||
|
||||
import net.azib.ipscan.config.Version;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* TXT Exporter Test
|
||||
@ -66,5 +70,14 @@ public class TXTExporterTest extends AbstractExporterTestCase {
|
||||
exporter.end();
|
||||
assertContains("192.168.1.1 - 192.168.3.255");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void importFromFile() throws Exception {
|
||||
String file = getClass().getResource("import.txt").getPath();
|
||||
AbstractFeederGUI feederGUI = mock(AbstractFeederGUI.class);
|
||||
|
||||
List<ScanningResult> results = ((TXTExporter) exporter).importResults(file, feederGUI);
|
||||
|
||||
assertEquals(7, results.size());
|
||||
}
|
||||
}
|
||||
|
||||
14
test/net/azib/ipscan/exporters/import.txt
Normal file
14
test/net/azib/ipscan/exporters/import.txt
Normal file
@ -0,0 +1,14 @@
|
||||
Generated by Angry IP Scanner current
|
||||
http://angryip.org
|
||||
|
||||
Scanned 192.168.0.0 - 192.168.0.255
|
||||
01-Sep-2015 23:47:27
|
||||
|
||||
IP Ping Hostname Ports Comments MAC Vendor MAC Address
|
||||
192.168.0.1 3 ms router.local 80 [n/a] CiscoSpv E4:48:C7:EE:28:C2
|
||||
192.168.0.3 1 ms accesspoint.local 22,80 [n/a] Tp-LinkT 30:B5:C2:B9:B9:4E
|
||||
192.168.0.2 0 ms nas.local 22,80,443 [n/a] Synology 00:11:32:0E:92:BC
|
||||
192.168.0.13 0 ms aziber.local 22 [n/a] IntelCor 7C:7A:91:15:8C:6D
|
||||
192.168.0.10 2 ms [n/a] [n/a] [n/a] Azurewav 6C:AD:F8:74:CB:0F
|
||||
192.168.0.15 5 ms [n/a] [n/a] [n/a] IntekDig 30:EB:25:00:A0:F8
|
||||
192.168.0.18 60 ms [n/a] [n/a] [n/a] LgElectr 34:FC:EF:DC:29:2B
|
||||
Loading…
Reference in New Issue
Block a user