From 6c202e8f1dabbec7a8b1834b870a1f60a54d94e1 Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 15 Mar 2014 19:40:41 +0000 Subject: [PATCH] fix router identity test broken by previous checkin --- core/java/src/net/i2p/data/KeysAndCert.java | 12 ++++++++++++ .../test/junit/net/i2p/data/RouterIdentityTest.java | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/core/java/src/net/i2p/data/KeysAndCert.java b/core/java/src/net/i2p/data/KeysAndCert.java index 3a181c7a95..8e9bcaab1c 100644 --- a/core/java/src/net/i2p/data/KeysAndCert.java +++ b/core/java/src/net/i2p/data/KeysAndCert.java @@ -151,11 +151,23 @@ public class KeysAndCert extends DataStructureImpl { return buf.toString(); } + /** + * Throws IllegalStateException if keys and cert are not initialized, + * as of 0.9.12. Prior to that, returned null. + * + * @throws IllegalStateException + */ @Override public Hash calculateHash() { return getHash(); } + /** + * Throws IllegalStateException if keys and cert are not initialized, + * as of 0.9.12. Prior to that, returned null. + * + * @throws IllegalStateException + */ public Hash getHash() { if (__calculatedHash != null) return __calculatedHash; diff --git a/core/java/test/junit/net/i2p/data/RouterIdentityTest.java b/core/java/test/junit/net/i2p/data/RouterIdentityTest.java index ce1978ebcd..e5fdc93e9e 100644 --- a/core/java/test/junit/net/i2p/data/RouterIdentityTest.java +++ b/core/java/test/junit/net/i2p/data/RouterIdentityTest.java @@ -101,9 +101,15 @@ public class RouterIdentityTest extends StructureTest { ident.calculateHash(); } - public void testBadHash() throws Exception{ + public void testBadHash() throws Exception { RouterIdentity ident = new RouterIdentity(); - ident.getHash(); + boolean error = false; + try { + ident.getHash(); + } catch (IllegalStateException ise) { + error = true; + } + assertTrue(error); }