Add too weak custom encryption exception (#1119)

* Add too weak custom encryption exception
This commit is contained in:
Joël
2018-08-28 19:45:58 +02:00
committed by Ryan Baxter
parent 0395ad06cb
commit 4ee026b03d
3 changed files with 23 additions and 8 deletions

View File

@@ -35,7 +35,7 @@ public class EncryptionControllerMultiTextEncryptorTests {
encrypted, TEXT_PLAIN));
}
@Test(expected = KeyNotInstalledException.class)
@Test(expected = EncryptionTooWeakException.class)
public void shouldNotEncryptUsingNoOp() {
// given
String application = "unknown";
@@ -46,7 +46,7 @@ public class EncryptionControllerMultiTextEncryptorTests {
// then exception is thrown
}
@Test(expected = KeyNotInstalledException.class)
@Test(expected = EncryptionTooWeakException.class)
public void shouldNotDecryptUsingNoOp() {
// given
String application = "unknown";

View File

@@ -45,12 +45,12 @@ public class EncryptionControllerTests {
private EncryptionController controller = new EncryptionController(
new SingleTextEncryptorLocator(Encryptors.noOpText()));
@Test(expected = KeyNotInstalledException.class)
@Test(expected = EncryptionTooWeakException.class)
public void cannotDecryptWithoutKey() {
this.controller.decrypt("foo", MediaType.TEXT_PLAIN);
}
@Test(expected = KeyNotInstalledException.class)
@Test(expected = EncryptionTooWeakException.class)
public void cannotDecryptWithNoopEncryptor() {
this.controller.decrypt("foo", MediaType.TEXT_PLAIN);
}