mirror of
https://github.com/i2p/i2p.i2p.git
synced 2026-10-23 21:44:41 +00:00
Added some tests of setOptions to RouterAddressTest
This commit is contained in:
1 parent
f19ef3e486
commit
e7922c4ded
1 file changed
+30
-3
@@ -33,7 +33,34 @@ public class RouterAddressTest extends StructureTest {
|
||||
return addr;
|
||||
}
|
||||
public DataStructure createStructureToRead() { return new RouterAddress(); }
|
||||
|
||||
|
||||
public void testSetNullOptions(){
|
||||
RouterAddress addr = new RouterAddress();
|
||||
boolean error = false;
|
||||
try{
|
||||
addr.setOptions(null);
|
||||
}catch(NullPointerException dfe){
|
||||
error = true;
|
||||
}
|
||||
assertTrue(error);
|
||||
}
|
||||
|
||||
public void testSetOptionsAgain(){
|
||||
RouterAddress addr = new RouterAddress();
|
||||
Properties options = new Properties();
|
||||
options.setProperty("hostname", "localhost");
|
||||
options.setProperty("portnum", "1234");
|
||||
addr.setOptions(options);
|
||||
options.setProperty("portnum", "2345");
|
||||
boolean error = false;
|
||||
try{
|
||||
addr.setOptions(options);
|
||||
}catch(IllegalStateException dfe){
|
||||
error = true;
|
||||
}
|
||||
assertTrue(error);
|
||||
}
|
||||
|
||||
public void testBadWrite() throws Exception{
|
||||
RouterAddress addr = new RouterAddress();
|
||||
boolean error = false;
|
||||
@@ -44,7 +71,7 @@ public class RouterAddressTest extends StructureTest {
|
||||
}
|
||||
assertTrue(error);
|
||||
}
|
||||
|
||||
|
||||
public void testNullEquals(){
|
||||
RouterAddress addr = new RouterAddress();
|
||||
byte data[] = new byte[32];
|
||||
@@ -60,7 +87,7 @@ public class RouterAddressTest extends StructureTest {
|
||||
assertFalse(addr.equals(null));
|
||||
assertFalse(addr.equals(""));
|
||||
}
|
||||
|
||||
|
||||
public void testToString(){
|
||||
RouterAddress addr = new RouterAddress();
|
||||
byte data[] = new byte[32];
|
||||
|
||||
Reference in new issue
Block a user