diff --git a/core/java/test/net/i2p/data/RouterAddressTest.java b/core/java/test/net/i2p/data/RouterAddressTest.java index 3e8791e73cd3452a03a9b5ab5f3aeb74a4380d47..5ee9c0deba6259dd3ed01bfb0a0be74da79bcef1 100644 --- a/core/java/test/net/i2p/data/RouterAddressTest.java +++ b/core/java/test/net/i2p/data/RouterAddressTest.java @@ -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];