fix router identity test broken by previous checkin

This commit is contained in:
zzz
2014-03-15 19:40:41 +00:00
parent 24e6750529
commit 6c202e8f1d
2 changed files with 20 additions and 2 deletions

View File

@ -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;

View File

@ -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);
}