Fix net.i2p.data.*Key tests, remove dead code

Broken in 463f5347b682f23a159bdeb06ffc8f55c5c2cff7 by an underlying API change.
The dead code threw the previously-expected exception.
This commit is contained in:
str4d
2017-12-02 17:42:59 +00:00
parent 60efd0b426
commit b8eeb72044
5 changed files with 14 additions and 12 deletions

View File

@ -12,6 +12,7 @@ import static org.junit.Assert.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import org.junit.Rule;
import org.junit.Test;
@ -87,8 +88,8 @@ public class PrivateKeyTest extends StructureTest {
PrivateKey privateKey = new PrivateKey();
ByteArrayInputStream in = new ByteArrayInputStream(DataHelper.getASCII("six times nine equals forty-two"));
exception.expect(DataFormatException.class);
exception.expectMessage("EOF reading PrivateKey, read: 31, required: " + PrivateKey.KEYSIZE_BYTES);
exception.expect(EOFException.class);
exception.expectMessage("EOF after reading 31 bytes of " + PrivateKey.KEYSIZE_BYTES + " byte value");
privateKey.readBytes(in);
}
}

View File

@ -12,6 +12,7 @@ import static org.junit.Assert.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import org.junit.Rule;
import org.junit.Test;
@ -88,8 +89,8 @@ public class PublicKeyTest extends StructureTest {
PublicKey publicKey = new PublicKey();
ByteArrayInputStream in = new ByteArrayInputStream(DataHelper.getASCII("six times nine equals forty-two"));
exception.expect(DataFormatException.class);
exception.expectMessage("EOF reading PublicKey, read: 31, required: " + PublicKey.KEYSIZE_BYTES);
exception.expect(EOFException.class);
exception.expectMessage("EOF after reading 31 bytes of " + PublicKey.KEYSIZE_BYTES + " byte value");
publicKey.readBytes(in);
}
}

View File

@ -12,6 +12,7 @@ import static org.junit.Assert.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import org.junit.Rule;
import org.junit.Test;
@ -88,8 +89,8 @@ public class SigningPrivateKeyTest extends StructureTest {
SigningPrivateKey signingPrivateKey = new SigningPrivateKey();
ByteArrayInputStream in = new ByteArrayInputStream(DataHelper.getASCII("short"));
exception.expect(DataFormatException.class);
exception.expectMessage("EOF reading SigningPrivateKey, read: 5, required: " + SigningPrivateKey.KEYSIZE_BYTES);
exception.expect(EOFException.class);
exception.expectMessage("EOF after reading 5 bytes of " + SigningPrivateKey.KEYSIZE_BYTES + " byte value");
signingPrivateKey.readBytes(in);
}
}

View File

@ -12,6 +12,7 @@ import static org.junit.Assert.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import org.junit.Rule;
import org.junit.Test;
@ -88,8 +89,8 @@ public class SigningPublicKeyTest extends StructureTest {
SigningPublicKey publicKey = new SigningPublicKey();
ByteArrayInputStream in = new ByteArrayInputStream(DataHelper.getASCII("six times nine equals forty-two"));
exception.expect(DataFormatException.class);
exception.expectMessage("EOF reading SigningPublicKey, read: 31, required: " + SigningPublicKey.KEYSIZE_BYTES);
exception.expect(EOFException.class);
exception.expectMessage("EOF after reading 31 bytes of " + SigningPublicKey.KEYSIZE_BYTES + " byte value");
publicKey.readBytes(in);
}
}